Fast algorithm to find root of strictly decreasing function

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 3K views
dabd
Messages
25
Reaction score
0
What is the fastest algorithm to find the closest root (such that the function value at that point is positive to an error but never negative, if not exactly zero) for a strictly decreasing function?
 
Physics news on Phys.org
If you can find the derivative of the function, Newton's tangent method, otherwise secant method.
 
dabd said:
What is the fastest algorithm to find the closest root (such that the function value at that point is positive to an error but never negative, if not exactly zero) for a strictly decreasing function?

In the Newton-Raphson Method, you do not need to find the derivative instead

Code:
private static double df(double x) {
		double del=0.000001;
		double x0=f(x+del)-f(x);
		x0=x0/del;
		return x0;
	}