Question: Python is used 1) Write a loop to approximate the mathematical constant e. Go tohttps://en.wikipedia.org/wiki/E_(mathematical_constant)to see the formula to do the approximation.You can use the

Python is used

1) Write a loop to approximate the mathematical constant e. Go tohttps://en.wikipedia.org/wiki/E_(mathematical_constant)to see the formula to do the approximation.You can use the factorial function of the math module, which willmake your task easier. Find thesmallest number of terms in the calculation so that your approximation and math.e deviate less than0.0000017. (50 points)

2) Write a loop to approximate the mathematical function sine. Go tohttp://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf to see the formula to do the approximation. Note that in the formula sin x, x is measured in radian. For example, if x is 13 degrees, x can be converted to radian as follows:

x = 13 # x is 13 degrees.

x = 13 / 180 *

math.pi # x is now in radian.

You also need to alternate the sign of the terms in the calculation. Use this (-1) ** n where n is the term number. Find the smallest number of terms in the calculation so that your approximation andmath.sin(13 / 180 * math.pi) deviate less than 1.0e-13. (50 points)

Below is the output it should return

 Python is used 1) Write a loop to approximate the mathematical

print("Number of terms proximation:,u, "math.sin(x)ath.sin(x)) Run Daber of terns: 1 Approxination: 1.0 Dber of terns: 2 Apzcriration: 2. er o terns: 3 Appzcxination: 2.5 IIxber of tana: 4 Approxination: 2.6666666666666665 baber of tern: 5 Approxination: 2.705333333333333 tember of terns: 2ppzox1net10n: 2.7166666666666663 Daber of te: 7 Appzxination: 2.71BDss5555555554 2ber of texna ppoxiatian: 2.718259682539684 Daber of term: 9 Ayproxination: 2.7182787698412 Karter of terns: 1C Jpprox1nat10 ; 2.1D2C2525573|922 mm ber of terns : 1 Approx1ration: D.226B92BD2759262ESIeth.11nCX): D224951054 34 3B65 mmber of tern: 2 Approxiatian: 0.2249460495C51871 3ath.aiL(x): .22495|C54343865 Bamber of terns: 3 pproxistign: 0.224 9510604815418 m,th.81n(x): .224951054343865 ber of terns APproriration: D.2249510543436706 ata.): D.224951054343B6 Proce finiahed with exit. code 0 Pythen Console 853 n/a UTF-8+

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!