Question: c o s ( x ) = k = 0 ( - 1 ) k x 2 k ( 2 k ) ! = 1

cos(x)=k=0(-1)kx2k(2k)!=1-x22!+x44!-x66!+cdots
Write a Python code that uses a while loop to implement a running sum which achieves 4 significant figures accuracy. Print your result for x=0.25 on screen using a formatted printing statement. It should only display t relevant significant figures.
Hints:
Use the factorial function from math library.
The while loop should start with while ea>es: where stopping criterion is calculated with formula, es=0.510(2-n)%, with n being the significant figures accuracy desired.
 cos(x)=k=0(-1)kx2k(2k)!=1-x22!+x44!-x66!+cdots Write a Python code that uses a while loop to

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!