You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Phil Steitz (JIRA)" <ji...@apache.org> on 2010/03/09 00:01:28 UTC

[jira] Resolved: (MATH-301) Erf(z) should return 1.0 for z 'large' but fails with a MaxIterationsExceededException for z > 26.0.

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

Phil Steitz resolved MATH-301.
------------------------------

    Resolution: Fixed

Fixed in r920558.

> Erf(z) should return 1.0 for z 'large' but  fails with a MaxIterationsExceededException for z > 26.0.
> -----------------------------------------------------------------------------------------------------
>
>                 Key: MATH-301
>                 URL: https://issues.apache.org/jira/browse/MATH-301
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: MacOS and Linux
>            Reporter: Tom Milac
>             Fix For: 2.1
>
>         Attachments: erf.txt
>
>
> Erf(z) should return 1.0 for z 'large' but fails with a MaxIterationsExceededException for z > 26.0.
> Sample code
> -----------------
> import org.apache.commons.math.MathException;
> import org.apache.commons.math.special.Erf;
> public class TestErf {
>     public TestErf() {
>     }
>     public static void main(String[] args) {
>         double z = Double.NEGATIVE_INFINITY;
>         try {
>             for(int i=0; i<100; i++) {
>                 z = i;
>                 System.out.println("z = " + z + "  erf(z) = " + Erf.erf(z));
>             }
>             System.out.flush();
>         } catch (MathException mex) {
>             System.out.println("z failed = " + z);
>             mex.printStackTrace();
>         }
>     }
> }
> Output
> ---------
> z = 0.0  erf(z) = 0.0
> z = 1.0  erf(z) = 0.842700792949715
> z = 2.0  erf(z) = 0.9953222650189528
> z = 3.0  erf(z) = 0.9999779095030024
> z = 4.0  erf(z) = 0.9999999845827416
> z = 5.0  erf(z) = 0.9999999999984622
> z = 6.0  erf(z) = 0.9999999999999997
> z = 7.0  erf(z) = 1.000000000000001
> z = 8.0  erf(z) = 0.9999999999999986
> z = 9.0  erf(z) = 1.000000000000003
> z = 10.0  erf(z) = 1.0000000000000115
> z = 11.0  erf(z) = 1.0000000000000016
> z = 12.0  erf(z) = 0.9999999999999941
> z = 13.0  erf(z) = 0.9999999999999846
> z = 14.0  erf(z) = 1.0000000000000024
> z = 15.0  erf(z) = 0.9999999999999805
> z = 16.0  erf(z) = 0.9999999999999988
> z = 17.0  erf(z) = 0.9999999999999949
> z = 18.0  erf(z) = 0.9999999999999907
> z = 19.0  erf(z) = 0.9999999999999731
> z = 20.0  erf(z) = 0.9999999999999862
> z = 21.0  erf(z) = 0.9999999999999721
> z = 22.0  erf(z) = 1.000000000000017
> z = 23.0  erf(z) = 1.0000000000000577
> z = 24.0  erf(z) = 1.000000000000054
> z = 25.0  erf(z) = 1.0000000000000262
> z = 26.0  erf(z) = 1.0000000000000735
> z failed = 27.0
> org.apache.commons.math.MaxIterationsExceededException: Maximal number of iterations (10,000) exceeded
>         at org.apache.commons.math.special.Gamma.regularizedGammaP(Gamma.java:181)
>         at org.apache.commons.math.special.Erf.erf(Erf.java:51)
>         at org.fhcrc.math.minimization.TestErf.main(TestErf.java:23)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.