You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dennis Hendriks (JIRA)" <ji...@apache.org> on 2011/06/17 16:46:47 UTC
[jira] [Created] (MATH-596) GraggBulirschStoerIntegrator output too
low
GraggBulirschStoerIntegrator output too low
-------------------------------------------
Key: MATH-596
URL: https://issues.apache.org/jira/browse/MATH-596
Project: Commons Math
Issue Type: Bug
Affects Versions: 3.0
Reporter: Dennis Hendriks
Attachments: MyTest.java
I have the following problem:
x(3.0) = 4.0
x' = 3.0
t0 = 3.0
tend = 10.0
ODE solving using the GraggBulirschStoerIntegrator(1e-10, 100.0, 1e-7, 1e-7) integrator, gives me:
t, x, x'
3.0, 4.0, 3.0
3.105840007284127, 4.0, 3.0
3.829973288493221, 4.31752002185238, 3.0
8.784328663271161, 6.489919865479664, 3.0
10.0, 21.35298598981348, 3.0
Clearly, the value of x at time 3.10... should be something like 4.30... and not 4.0. Also, the value of x at time 10.0 should be around 25.0 and not be 21.35...
If we switch to the DormandPrince853Integrator(1e-10, 100.0, 1e-7, 1e-7), it gives me:
3.0, 4.0, 3.0
3.079933916721644, 4.239801750164932, 3.0
3.8792730839380845, 6.637819251814253, 3.0
10.0, 24.999999999999996, 3.0
as expected.
This seems to me like the GraggBulirschStoerIntegrator has a bug...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-596) GraggBulirschStoerIntegrator output
too low
Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055094#comment-13055094 ]
Luc Maisonobe commented on MATH-596:
------------------------------------
Yes, I think the optional dense output feature is the only problem here.
When the step handler doesn't requirs dense output and there are no events, a dummy step interpolator is used. This is due to the following statements in the integrator:
{code}
if (denseOutput) {
interpolator = new GraggBulirschStoerStepInterpolator(y, yDot0,
y1, yDot1,
yMidDots, forward);
} else {
interpolator = new DummyStepInterpolator(y, yDot1, forward);
}
{code}
So in your case, you get a DummyStepInterpolator which simply copies some intermediate states computed earlier.
I will open a separate issue for removing optional dense output, solve the new issue and solve this one afterwards.
> GraggBulirschStoerIntegrator output too low
> -------------------------------------------
>
> Key: MATH-596
> URL: https://issues.apache.org/jira/browse/MATH-596
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Dennis Hendriks
> Attachments: MyTest.java, MyTest2.java
>
>
> I have the following problem:
> x(3.0) = 4.0
> x' = 3.0
> t0 = 3.0
> tend = 10.0
> ODE solving using the GraggBulirschStoerIntegrator(1e-10, 100.0, 1e-7, 1e-7) integrator, gives me:
> t, x, x'
> 3.0, 4.0, 3.0
> 3.105840007284127, 4.0, 3.0
> 3.829973288493221, 4.31752002185238, 3.0
> 8.784328663271161, 6.489919865479664, 3.0
> 10.0, 21.35298598981348, 3.0
> Clearly, the value of x at time 3.10... should be something like 4.30... and not 4.0. Also, the value of x at time 10.0 should be around 25.0 and not be 21.35...
> If we switch to the DormandPrince853Integrator(1e-10, 100.0, 1e-7, 1e-7), it gives me:
> 3.0, 4.0, 3.0
> 3.079933916721644, 4.239801750164932, 3.0
> 3.8792730839380845, 6.637819251814253, 3.0
> 10.0, 24.999999999999996, 3.0
> as expected.
> This seems to me like the GraggBulirschStoerIntegrator has a bug...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-596) GraggBulirschStoerIntegrator output
too low
Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13053278#comment-13053278 ]
Luc Maisonobe commented on MATH-596:
------------------------------------
It seems to me the problem is related to the interpolator the integrator sends to the step handler.
If I change the implementation of requiresDenseOutput to return true instead of false in the step handle, the error becomes about 9e-16.
Could you check this change completely solves the problem for you.
This requiresDenseOutput was added long ago (even before this code was included in Apache Commons Math) as an optimization to avoid calling computeDerivatives too many times for some integrators. In fact, only Dormand-Prince 8 (5,3) needs it because if the interpolator is not used, we can save 3 calls per step.
Now I think this feature brings more problems than it solves:
- it forces users to implement this method despite its purpose is not clear,
- obviously it creates problems with at least Gragg-Bulirsch-Stoer since this
integrator really needs interpolation
- it will create the same problems for Adams integrators (they also need interpolation)
- this "optimization" is useful only for one integrator
- in many cases, even for this integrator it does not optimize anything since
people will need interpolation
So I would like to completely remove this.
I'm switching to the developers mailing list to discuss about it. It is a better place for discussion than
this JIRA issue. Please join the discussion here, and we will post the conclusion to complete this report.
> GraggBulirschStoerIntegrator output too low
> -------------------------------------------
>
> Key: MATH-596
> URL: https://issues.apache.org/jira/browse/MATH-596
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Dennis Hendriks
> Attachments: MyTest.java
>
>
> I have the following problem:
> x(3.0) = 4.0
> x' = 3.0
> t0 = 3.0
> tend = 10.0
> ODE solving using the GraggBulirschStoerIntegrator(1e-10, 100.0, 1e-7, 1e-7) integrator, gives me:
> t, x, x'
> 3.0, 4.0, 3.0
> 3.105840007284127, 4.0, 3.0
> 3.829973288493221, 4.31752002185238, 3.0
> 8.784328663271161, 6.489919865479664, 3.0
> 10.0, 21.35298598981348, 3.0
> Clearly, the value of x at time 3.10... should be something like 4.30... and not 4.0. Also, the value of x at time 10.0 should be around 25.0 and not be 21.35...
> If we switch to the DormandPrince853Integrator(1e-10, 100.0, 1e-7, 1e-7), it gives me:
> 3.0, 4.0, 3.0
> 3.079933916721644, 4.239801750164932, 3.0
> 3.8792730839380845, 6.637819251814253, 3.0
> 10.0, 24.999999999999996, 3.0
> as expected.
> This seems to me like the GraggBulirschStoerIntegrator has a bug...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (MATH-596) GraggBulirschStoerIntegrator output too
low
Posted by "Dennis Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dennis Hendriks updated MATH-596:
---------------------------------
Attachment: MyTest2.java
New test, with output for both dense and non-dense step handler.
Note how for the non-dense step handler, the derivatives are computed for 10.0, and the result is 24.999999999999996. It then continues to call the step handler for time 10.0 with value 21.35298598981348, which is the value calculated for time 8.784328663271161, from before the previous time the step handler was called. It seems the compute derivative method is called for the appropriate times, only the output is not correctly used to set the interpolator values.
If you think this is indeed *only* caused by the optionality of dense output, or it is no longer relevant if non-dense output is removed, then removing the non-dense option would indeed fix this issue.
It would probably be better to create a separate issue for the removal of non-dense output. I have no objections to the removal of non-dense output.
> GraggBulirschStoerIntegrator output too low
> -------------------------------------------
>
> Key: MATH-596
> URL: https://issues.apache.org/jira/browse/MATH-596
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Dennis Hendriks
> Attachments: MyTest.java, MyTest2.java
>
>
> I have the following problem:
> x(3.0) = 4.0
> x' = 3.0
> t0 = 3.0
> tend = 10.0
> ODE solving using the GraggBulirschStoerIntegrator(1e-10, 100.0, 1e-7, 1e-7) integrator, gives me:
> t, x, x'
> 3.0, 4.0, 3.0
> 3.105840007284127, 4.0, 3.0
> 3.829973288493221, 4.31752002185238, 3.0
> 8.784328663271161, 6.489919865479664, 3.0
> 10.0, 21.35298598981348, 3.0
> Clearly, the value of x at time 3.10... should be something like 4.30... and not 4.0. Also, the value of x at time 10.0 should be around 25.0 and not be 21.35...
> If we switch to the DormandPrince853Integrator(1e-10, 100.0, 1e-7, 1e-7), it gives me:
> 3.0, 4.0, 3.0
> 3.079933916721644, 4.239801750164932, 3.0
> 3.8792730839380845, 6.637819251814253, 3.0
> 10.0, 24.999999999999996, 3.0
> as expected.
> This seems to me like the GraggBulirschStoerIntegrator has a bug...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (MATH-596) GraggBulirschStoerIntegrator output
too low
Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luc Maisonobe resolved MATH-596.
--------------------------------
Resolution: Fixed
Fixed in subversion repository as of r1139831.
Thanks for the report
> GraggBulirschStoerIntegrator output too low
> -------------------------------------------
>
> Key: MATH-596
> URL: https://issues.apache.org/jira/browse/MATH-596
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Dennis Hendriks
> Attachments: MyTest.java, MyTest2.java
>
>
> I have the following problem:
> x(3.0) = 4.0
> x' = 3.0
> t0 = 3.0
> tend = 10.0
> ODE solving using the GraggBulirschStoerIntegrator(1e-10, 100.0, 1e-7, 1e-7) integrator, gives me:
> t, x, x'
> 3.0, 4.0, 3.0
> 3.105840007284127, 4.0, 3.0
> 3.829973288493221, 4.31752002185238, 3.0
> 8.784328663271161, 6.489919865479664, 3.0
> 10.0, 21.35298598981348, 3.0
> Clearly, the value of x at time 3.10... should be something like 4.30... and not 4.0. Also, the value of x at time 10.0 should be around 25.0 and not be 21.35...
> If we switch to the DormandPrince853Integrator(1e-10, 100.0, 1e-7, 1e-7), it gives me:
> 3.0, 4.0, 3.0
> 3.079933916721644, 4.239801750164932, 3.0
> 3.8792730839380845, 6.637819251814253, 3.0
> 10.0, 24.999999999999996, 3.0
> as expected.
> This seems to me like the GraggBulirschStoerIntegrator has a bug...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (MATH-596) GraggBulirschStoerIntegrator output too
low
Posted by "Dennis Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dennis Hendriks updated MATH-596:
---------------------------------
Attachment: MyTest.java
This is the file I used to test this. Running it gives the output as given in de issue description.
> GraggBulirschStoerIntegrator output too low
> -------------------------------------------
>
> Key: MATH-596
> URL: https://issues.apache.org/jira/browse/MATH-596
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Dennis Hendriks
> Attachments: MyTest.java
>
>
> I have the following problem:
> x(3.0) = 4.0
> x' = 3.0
> t0 = 3.0
> tend = 10.0
> ODE solving using the GraggBulirschStoerIntegrator(1e-10, 100.0, 1e-7, 1e-7) integrator, gives me:
> t, x, x'
> 3.0, 4.0, 3.0
> 3.105840007284127, 4.0, 3.0
> 3.829973288493221, 4.31752002185238, 3.0
> 8.784328663271161, 6.489919865479664, 3.0
> 10.0, 21.35298598981348, 3.0
> Clearly, the value of x at time 3.10... should be something like 4.30... and not 4.0. Also, the value of x at time 10.0 should be around 25.0 and not be 21.35...
> If we switch to the DormandPrince853Integrator(1e-10, 100.0, 1e-7, 1e-7), it gives me:
> 3.0, 4.0, 3.0
> 3.079933916721644, 4.239801750164932, 3.0
> 3.8792730839380845, 6.637819251814253, 3.0
> 10.0, 24.999999999999996, 3.0
> as expected.
> This seems to me like the GraggBulirschStoerIntegrator has a bug...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira