Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following relation xn+1 = + 0.25 n = 0, 1, 2, , 200 Let x0 = 0, and

ID: 3528824 • Letter: C

Question

Consider the following relation xn+1 = + 0.25 n = 0, 1, 2, , 200 Let x0 = 0, and use this iterative formula to compute X200. Do this with a for loop. Additionally, save the values of xn in an array. After the for loop, plot xn versus n for n = 0, 4, 9, . (every 5th element). For the third argument of the plot function, use, plot (, , 'ks '), which will plot the values of xn as squares. To what value does xN appear to converge? Note that all xn, n = 0, 1, 2, 200, must be computed, but only every fifth xn is plotted.

Explanation / Answer

The value of X200 is 0.495195.

The c++ code :

#include<iostream>

#include<math.h>

using namespace std;

int main(){

double x0=0.0,xn;

int N=0;

while(N<=200)

{

xn=x0*x0+0.25;

x0=xn;

if((N+1)%5==0)

{

std::cout<<N<<" "<<xn<<std::endl;

}

N++;

}

std::cout<<"x200="<<x0<<std::endl;

return 0;

}

The above program will generate the table.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote