Question: While the values of n increase in sequence, the value of n must be written to the taylor series ( ((-1)**n)*(num/denom) ) and display the
While the values of n increase in sequence, the value of n must be written to the taylor series ( ((-1)**n)*(num/denom) ) and display the sums in order. Could you help as early as possible? Could you show appropriate loops?
import math x = 1.07 n=0 num1=x**(2*n) deno1=math.factorial(2*n) taylor1= ((-1)**n)*(num1/deno1) print(taylor1)
n=1 num1=x**(2*n) deno1=math.factorial(2*n) taylor2= ((-1)**n)*(num1/deno1) print(taylor2)
n=2 num1=x**(2*n) deno1=math.factorial(2*n) taylor3= ((-1)**n)*(num1/deno1) print(taylor3)
n=3 num1=x**(2*n) deno1=math.factorial(2*n) taylor4= ((-1)**n)*(num1/deno1) print(taylor4) sum_taylor=taylor1+taylor2+taylor3+taylor4 print("according to taylor series,cos(x) sum is",sum_taylor)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
