CPPForSchool.com: Flow of Control Set 2: Assignment 14

14. Compute the natural logarithm of 2, by adding up to n terms in the series
1 - 1/2 + 1/3 - 1/4 + 1/5 -... 1/n
where n is a positive integer and input by user.


It appears to be a running theme for math to rack my brain.  Like prior assignments with unknown math concepts, this one flew right over my head.  However, I am no stranger to diving into the unknown so here we go!

According to MathsIsFun, logarithms is the process of determining how many of one number do we multiply to get another number.

Example: How many 2s do we multiply to get 8?
Answer: 2 × 2 × 2 = 8, so we had to multiply 3 of the 2s to get 8
So the logarithm is 3

However, the assignment parameters do not match the MathsIsFun definition/example.  With that said, I will focus on replicating the assignment parameters, specifically the formula.  I am approaching it this way because I found another means of calculating logarithms.  It utilizes the math library, which is not indicative to the assignment, specifically the format of the algorithm.









Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 7