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

/* Roots of an Equation -Newton-Raphson Method*/ #include <stdio.h> #include <ma

ID: 3712845 • Letter: #

Question

/* Roots of an Equation -Newton-Raphson Method*/

#include <stdio.h>

#include <math.h>

#define EPS0 1.0e-12

double f(double x);

double fp(double x);

double newton_raphson(double x, double eps);

int main(){

double xi = 2, eps = 1.0e-6;

printf( "The root is %f ", newton_raphson(xi, eps) );

return 0;}

double f(double x){

double y;

y = x*x*x - 3*(x*x)+ 2.3146*x - .504188;

return y;}

double fp(double x){

double y;

y = 3*(x*x)-6*x+2.3146;

return y;

}

double newton_raphson(double x, double eps){

double x1, dx, fx, fpx;

do {fx = f(x);

fpx = fp(x);

if (fabs(fpx) < EPS0){

printf( "Warning: slope --> 0 !!! ");

break;}

x1 = x -fx/fpx;

dx = x1 -x;

x = x1;}

while (fabs(dx) > eps || fabs(fx) > EPS0);

return x1;

}

And please help me with this one

Problem 3: Newton-Raphson method: Modify a C code to find the roots of equation with initial guess of xo = 2: f(A)= ?. 3A" + 2.31462-0.504188 = 0 df fa)-4. 3 2-62+ 2.3146

Explanation / Answer

Sol:(5) You can try this code. I did this for my assignmnet and should work fine. It has been modified for the given function.