I am trying to solve the following mathematical equation for "V" using the apache-commons-math solver.
Equation :
V = log(X/ (V-1))
Following is the MWE;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.analysis.solvers.*;
public class Test {
public static void main(String[] args) {
UnivariateFunction function = v -> v - Math.log( (9/(v-1)) );
UnivariateSolver solver = new BrentSolver();
double c = solver.solve(100, function, -10.0, 10.0, 0);
System.out.println(c);
}
}
However, I get the following error;
Exception in thread "main" org.apache.commons.math3.exception.NoBracketingException: function values at endpoints do not have different signs, endpoints: [-10, 10], values: [�, 10]
I have looked around the internet to solve it but so far no success. I am looking for an MWE to solve "V", any help will be highly appreciated.