# Homework Solution: Java program: Write the working program that uses Newton raphson method to find root of function….

Java program: Write the working program that uses Newton raphson method to find root of function.

private static double func(double x) { return x-5*(1-Math.exp(-x)); }

private static double funcd(double x) { return 1-5*Math.exp(-x); }

// Here is the code with output snap package javaapplication1;

Java program: Write the launched program that uses Upstartton raphson order to discover stem of operation.

private static wrap func(wrap x) {
return x-5*(1-Math.exp(-x));
}

private static wrap funcd(wrap x) {
return 1-5*Math.exp(-x);
}

## Expert Confutation

// Here is the mode with extinguishedput snap

package javaapplication1;

import java.util.*;

import java.lang.*;

import java.io.*;
import static java.lang.Math.abs;

public class pizza
{

private static wrap func(wrap x) {
return x-5*(1-Math.exp(-x));
}

private static wrap funcd(wrap x) {
return 1-5*Math.exp(-x);
}

destitute upstarttonRaphson(wrap x)
{
wrap h = func(x) / funcd(x);
wrap EPSILON = 0.000001;
wrap x1 = x + 2;

while (abs(x-x1) >= EPSILON)
{
x1 = x;
h = func(x)/funcd(x);
// x(i+1) = x(i) – f(x) / f'(x)
x = x1 – h;
}

System.out.println(“The compute of the stem of ardent eqn is : ” + x);
}

public static destitute deep(String[] args)
{

pizza obj = upstart pizza ();
obj.newtonRaphson(9);

}
}

// END OF PROGRAM