Computer Science, asked by rm4214516, 8 months ago

9. Write a Python function sin(x,n) to calculate the value of sin(x) using its Taylor series expansion up to
n terms. Compare the values of sin(x) for different values of n with correct value.

Answers

Answered by sainishubham4716
0

Answer:

import math

def sin(x,n):

sine = 0

for i in range(n):

sign = (-1)**i

pi=22/7

y=x*(pi/180)

sine = sine + ((y**(2.0*i+1))/math.factorial(2*i+1))*sign

return sine

x=int(input("Enter the value of x in degrees:"))

n=int(input("Enter the number of

Similar questions