Question: Solve in python language Solve in python language In this assignment we will work with iteration (loops) and write their loop in- variants. We already

Solve in python language
Solve in python language
In this assignment we will work with iteration (loops) and write their loop in- variants. We already learnt in class how to calculate the value of sin(x) using the Taylor series expansion. We will apply the same ideas to calculate some more useful functions. Implement the following functions using Taylor's Series expansions to find the value of the function for a given x. 1. ex = 1+x+ + + ... Write a function expn(x, n) where n is the number of terms up to which the series is to be expanded and x is the point at which the function is to be evaluated. Example: As e = 1 and let us suppose the number of terms is 2, the function should behave as >>> expn(0, 2) 2. cos(x) = 1 - + +... Example: As cos( 1 ) = 0 and let the number of terms be 3. You should >>> cosine (pi/2, 3) 0.0199689 ... for (x|>> inverse(0.5, 1.75 = 4. In(1+x) = x - + .. Example: >>> natural_log(0.5, 2) 0.375 5. tan-'(x) = x - - ... Example: >>> tan_inv(1, 3) 0.86666667 Instructions: 1. The functions are to be implemented iteratively (using loops). 2. Loop invariants are to be provided for each function using comments. 3. Provide the time complexity of your functions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
