commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Connor Petty (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MATH-1333) MullerSolver returns value that is out of bounds
Date Tue, 08 Mar 2016 02:16:40 GMT

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

Connor Petty updated MATH-1333:
-------------------------------
    Description: Not sure what went wrong here but in a bracket of [20,100] I got back -19.9!
 (was: 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 <cpmeister@users.sourceforge.net>
 */
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!");
        }
    }
}
)

> 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
>         Attachments: BrokenMuller.java
>
>
> Not sure what went wrong here but in a bracket of [20,100] I got back -19.9!



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

Mime
View raw message