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

Please provide the matlab code for the following Numerical Analysis problem: Wri

ID: 3923090 • Letter: P

Question

Please provide the matlab code for the following Numerical Analysis problem:

Write a matlab code for the resolution of squareroot x + 2 - x = 0 using the iteration method and the method presented: That is: Take x_0 = 0 and compute x_n+1 = squareroot xn + 2. Define (v_n)_n as in (1). v_n = x_n x_n+2 - x_n^2+1/x_n + 2 - 2x_n+1 + x_n. Compare the convergence rates for solving x = squareroot x + 2: One will print the errors x_n+2 -l, v_n - l with l the exact solution, as well as ratios |v_n - l|/|x_n+2 - l|, |v_n - l|/|v_n-1 - l|^k, k= 1, 2, .... One stops the iterations as soon as |v_n - v_n-1| lessthanorequalto 10^-13. Please return the code and results.

Explanation / Answer

include <iostream>
#include <cstdlib>
#include <string>
#include "String.h"
using namespace std;
int main (int argc, char **argv)
{
//Testing Default constructor, length, and print
String one;
cout << "The length of String one is: " << one.length() << endl;
cout << "The value of String one is: ";
one.print();
  
//Testing Alternate constructor, length, and print
char test[256] = "Hello world";
String two(test);
cout << "The length of String two is: " << two.length() << endl;
cout << "The value of String two is: ";
two.print();
  
//Testing the overloaded [] operator. This replaces your at() function.
cout << "The first letter is: " << two[0] << endl;
  
return 0;
}

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