Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-464

LegendreGaussIntegrator ignores defaultMaximalIterationCount and does 38 million iterations

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 3.0
    • Labels:
      None

      Description

      The following code results in count = 37801710 which is effectively an infinite loop for typical functions we are using
      (in GeoGebra)

      The argument defaultMaximalIterationCount = 100 is being ignored

      This is the version we are using:
      http://www.geogebra.org/trac/browser/trunk/geogebra/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java

      LegendreGaussIntegrator gauss = new LegendreGaussIntegrator(5, 100);

      try

      { double result = gauss.integrate(new testFun(), -10, 0.32462367623786328); }

      catch (Exception ee)

      { ee.printStackTrace(); }

      class testFun implements UnivariateRealFunction {

      public double value(double x) throws FunctionEvaluationException

      { count ++; if (x>=0 && x<=5) return 0.2; else return 0; }

      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              murkle Michael Borcherds
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 3h
                3h
                Remaining:
                Remaining Estimate - 3h
                3h
                Logged:
                Time Spent - Not Specified
                Not Specified