commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nipun Jawalkar (JIRA)" <j...@apache.org>
Subject [jira] Updated: (MATH-301) Erf(z) should return 1.0 for z 'large' but fails with a MaxIterationsExceededException for z > 26.0.
Date Thu, 29 Oct 2009 21:41:59 GMT

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

Nipun Jawalkar updated MATH-301:
--------------------------------

    Attachment: erf.txt

> 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
>         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.


Mime
View raw message