java - TooManyEvaluationsException when calculating integral of high-order polynomial using Apache Commons Math -


i'm using apache math calculate integrals of high order polynomials (degree 40 many terms) using code:

simpsonintegrator.integrate(integer.max_value, uf, 0, 100); 

however i'm getting exception:

exception in thread "main" org.apache.commons.math3.exception.toomanyevaluationsexception: illegal state: maximal count (2,147,483,647) exceeded: evaluations     @ org.apache.commons.math3.analysis.integration.baseabstractunivariateintegrator.computeobjectivevalue(baseabstractunivariateintegrator.java:235)     @ org.apache.commons.math3.analysis.integration.trapezoidintegrator.stage(trapezoidintegrator.java:135)     @ org.apache.commons.math3.analysis.integration.simpsonintegrator.dointegrate(simpsonintegrator.java:112)     @ org.apache.commons.math3.analysis.integration.baseabstractunivariateintegrator.integrate(baseabstractunivariateintegrator.java:280) 

can apache math calculate integrals complex?

example code below:

double[] coefficients = new double[] { 120.38735982092798, -7.432833370751281, -4.197678241326614,             1.935518550792998, -0.2717208510603644, 0.010272539175964844, 0.0014583652338223108,             -2.3545889963370238e-4, 1.7089604714800273e-5, -7.940595470645408e-7, 2.60400363658514e-8,             -6.295312573702475e-10, 1.147109622979095e-11, -1.591490268563359e-13, 1.683228910193124e-15,             -1.3473343508219034e-17, 8.022211284926259e-20, -3.4419978519650748e-22, 1.0053973045968942e-24,             -1.7889385990234268e-27, 1.4626500062261931e-30 };  polynomialfunction p = new polynomialfunction(coefficients);  univariatefunction uf = (univariatefunction) new polynomialfunction(p.multiply(p).getcoefficients());  // integrate regression simpsonintegrator integrator = new simpsonintegrator(); system.out.println("answer: " + (math.pi * integrator.integrate(integer.max_value, uf, 0, 100))); 

it's ok if takes long time solve, need answer eventually.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -