Question: Consider the following equations: f(x) = sin(pi*x)-x^2 = 0 g(x) = (1/2*pi)(sin(pi*x))-(1/2*pi)(x^2)+x We know that f(x)=0 has the same solution as g(x)=x. In fact, we

Consider the following equations:

f(x) = sin(pi*x)-x^2 = 0

g(x) = (1/2*pi)(sin(pi*x))-(1/2*pi)(x^2)+x

We know that f(x)=0 has the same solution as g(x)=x. In fact, we can show that for any initial point in (0,2] the sequence xk = g(xk1) converges to a unique solution x.

Write a Python function that computes this sequence. Your function should: Take for input the an initial point, a maximal number of iterations and a tolerance for |xk xk1| (the estimated error) and for |f(xk)| (the residual).

Print to the commend window the list of iterates, stopping when either the maximal number of iterations is reached or the estimated error and the residual are below their respective tolerance.

Output the approximate solution, its estimated error and its residual

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!