Question: Program // C++ program for implementation of Newton Raphson Method for // solving equations #include #define EPSILON 0.001 using namespace std; // An example function

Program
// C++ program for implementation of Newton Raphson Method for
// solving equations
#include
#define EPSILON 0.001
using namespace std;
// An example function whose solution is determined using
// Bisection Method. The function is e^xsinx - x^2 = 1
double func(double x)
{
return exp(x) * sin(x) - 1;
}
// Derivative of the above function which is 3*x^x - 2*x
double derivFunc(double x)
{
return (exp(x) * cos(x) + (exp(x) * sin(x)) - 2*x);
}
// Function to find the root
void newtonRaphson(double x)
{
double h = func(x) / derivFunc(x);
while (abs(h) >= EPSILON)
{
h = func(x)/derivFunc(x);
// x(i+1) = x(i) - f(x) / f'(x)
x = x - h;
}
cout
}
// Driver program to test above
int main()
{
double x0 = -20; // Initial values assumed
newtonRaphson(x0);
return 0;
}
Similarlyl other two problems can be solved by changing the derivative and func.
Problem 10.2. Modify the Newton-Raphson program provided in this chapter to solve the following system of equations. et sin x1 + x3 = 6 x +e-22 sin C2 = 1 Submit the print out the source code and output. Problem 10.2. Modify the Newton-Raphson program provided in this chapter to solve the following system of equations. et sin x1 + x3 = 6 x +e-22 sin C2 = 1 Submit the print out the source code and output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
