I need to use Newton's method using recursion. I have this piece of code using iterative Newton's method, but I'm very new to programming so I can't wrap my head around how to turn it into recursion. I would really appreciate some visual demonstration.
public static double f(double x){
return x*x*x-3.5*x*x+0.5*x + 5;
}
public static double prf(double x) {
return 3 * x * x - 7 * x + 0.5;
}
// ВЫЧИСЛЕНИЕ КОРНЯ МЕТОДОМ НЬЮТОНА
public static double x_newton(double a, double e) {
double x = a;
double razn;
do {
double xn = x - f(x) / prf(x);
razn = Math.abs(xn - x);
x = xn;
} while (razn > e);
return x - f(x)/prf(x);
}