Question: The following function was written to evaluate the sine function of some value x by the userselected order m of an infinite series approximation. Find

The following function was written to evaluate the sine function of some value x by the
userselected order m of an infinite series approximation. Find the error in the code, correct the
code, and explain the purpose of each line (including the format of the input and output).
def sincomparison(x, m):
i=1
sin = comparison value
ser =0
print(
)
print(order true value approximation error
)
while(True)
if j > m: break
ser = ser +(-1)^(j-1)* x**(2*j-1)/np.math.factorial(2*j-1)
er =(comparison value ser)/ comparison value *100
print(%3f %14.10f %14.10f %12.8f
, i,tru,ser,er)
retur

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!