[ 
https://issues.apache.org/jira/browse/MATH-1333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Connor Petty updated MATH-1333:
-------------------------------
    Priority: Major  (was: Minor)

> MullerSolver returns value that is out of bounds
> ------------------------------------------------
>
>                 Key: MATH-1333
>                 URL: https://issues.apache.org/jira/browse/MATH-1333
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6
>            Reporter: Connor Petty
>
> package whatever;
> import org.apache.commons.math3.analysis.UnivariateFunction;
> import org.apache.commons.math3.analysis.solvers.MullerSolver;
> import org.apache.commons.math3.util.FastMath;
> /**
>  *
>  * @author Connor Petty <[email protected]>
>  */
> public class BrokenMuller {
>     public static void main(String[] args) {
>         UnivariateFunction logFunction = new UnivariateFunction() {
>             private double log1pe(double x) {
>                 if (x > 0) {
>                     return x + FastMath.log1p(FastMath.exp(-x));
>                 } else {
>                     return FastMath.log1p(FastMath.exp(x));
>                 }
>             }
>             @Override
>             public double value(double x) {
>                 double a = 0.15076136473214652;
>                 double b = 4.880819340168248;
>                 double c = -2330.4196672490493;
>                 double d = 1.1871451743330544E-16;
>                 //aa*log(1+e^(bbx+c))+d - 0.01 * x - 20 * 0.01
>                 return a * a * log1pe(b * b * x + c) + d - 0.01 * x - 20 * 
> 0.01;
>             }
>         };
>         MullerSolver solver = new MullerSolver(0.25);
>         double min = 20;
>         double max = 100.04173804515072;
>         double result = solver.solve(1000, logFunction, min, max, 100.0/3.0);
>         if (result < min || result > max) {
>             throw new RuntimeException("value [" + result + "] is out of 
> bounds!");
>         }
>     }
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to