R9482/Homework2e515720e5e85master
Homework2
README.md
SP4E - Homework 2
General Info
This file provides a brief documentation and information related to the second Homework of the course "Scientific Programming for Engineers", fall 2019.
This homework is done by O. Ashtari and A. Sieber.
Last update: 10.30.2019
Project Description
The aim of this project is to implement a familly of objects intended to compute two types of series: an arithmetic series and a series to approximate the value of pi number. The user can then decide how to dump the results by either printing them to the screen or writing them to a file. If the later option is chosen, a python file is available to plot the results stored in the file.
Requirements
Installation
Running
Work separtion between the authors
The idea was writing mother classes as interfaces first. This task was done at the exercise session: structure of two classes Series and DumperSeries, including their virtual functions, was formed and written. To be abale to work remotely, each of us took one of the daughters of Series (namely compute_arithmetic and compute_pi) and one of the daughters of DumperSeries (namely PrintSeries and WriteSeries) to work on. Moreover, two other major tasks of writing a python script for visualization and modifying Series class to avoid re-calculations were split between authors. Each of us developed his own part and worked on his own main.cc. Finally, mains were merged and the project reviewed.
Concluding remarks
Complexity of the program
In the arithmetic series, summing from 1 to N needs N-1 summing operations. So, to see the result for different values of N, number of operations are:
N num. of operations 1 0 2 1 3 2 4 3 m m-1 sum: (m-1)(m-2)/2
However, if we keep track of the latest N and the value of latest value of summation, number of operations will be:
N num. of operations 1 0 2 1 3 1 4 1 m 1 sum: (m-1)