FDS : Week 3 : Problem 2 - Question 5

can you please explain the solution for this question in detail ?

I am not able to understand how this is computed — F(x, N’) - F(x, N’ - 1) and compared against the set value of epsilon

in this function we want to find F(x, N’) - F(x, N’-1) and compare against epsilon.
F(x, N’) = 1 + sum(pow(x, n)/factorial(n)) where n is 1 to N’
F(x, N’) - F(x, N’-1) = pow(x, N’)/factorial(N’) which is Compute_ratio function with x, N’ as parameter. so we are using compute_ratio function to calculate var and compare against epsilon and sum is calculated with in while loop by adding var to sum iteratively. so we dont need to call compute_sum function.


Thanks. Got it, Instead of asking the machine to perform this subtraction, we are subtracting it and choosing a relevant functions :slight_smile: