-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yampa
: improve accuracy of integral
#263
Comments
Which specific issue were you trying to point to? Is this a problem only in dunai or also in Yampa? |
@idontgetoutmuch Please let us know the details. I'll close this issue in a couple of days otherwise. Thanks! |
With
I get But with
I get what I expect Full code is here: https://github.com/idontgetoutmuch/phd-jonathan-thaler/commits/literate-haskell-for-review. In particular, it should be possible to run this: https://github.com/idontgetoutmuch/phd-jonathan-thaler/blob/literate-haskell-for-review/SIRABM.lhs#L262. |
Thanks! Based on past simulations, I think this is a problem with Yampa. If we can identify the problem there, we should fix it in Yampa and then just make bearriver adopt the same solution as Yampa (or one that is extensionally equivalent). |
This (lifted from https://github.com/miguel-negrao/test-integral/blob/main/app/Main.hs) works but I don't know how you could apply this to Yampa (thanks @miguel-negrao).
|
Maybe this?
|
Isn't this a duplicate of ivanperez-keera/dunai#268 ? |
Probably |
I made the change and with a test program it works. Here's my test
Here's the problem and after the fix But if I run the yampa tests then they just hang :-( I have put a PR here so you can try it yourself: #262 |
I don't know what to do about tests that just hang. I don't understand yampa sufficiently to debug it. |
This issue pertains to Yampa. I'm transferring it there. |
There are some small errors (the height going over 15 or under 0). What happens if you run this for a really long time? Do those always cancel out or do they accumulate? |
integral
is numerically unstableyampa
: integral
is numerically unstable
yampa
: integral
is numerically unstableyampa
: improve accuracy of integral
@idontgetoutmuch Sorry, this may be a bit off-topic. Could you please tell me how you generate these signal diagrams with Yampa. Very thanks. |
@chansey97 Full code is here: https://github.com/idontgetoutmuch/phd-jonathan-thaler/commits/literate-haskell-for-review. In particular, it should be possible to run this: https://github.com/idontgetoutmuch/phd-jonathan-thaler/blob/literate-haskell-for-review/SIRABM.lhs#L262. |
I'd like to move this issue forward. Would someone be willing to help by putting together a test that measures the difference between the old integral and the new integral for several input functions with known integrals, and with varying sampling rates? I'm thinking of something that will measure the distance between each implementation and the known integral, for example, measure |
I wrote a quick naive version of it. Was this more or less what you meant?
As far as I can tell the new version is better for most if not all cases. |
I don't have time to think about it further at the moment but why not make the integration method a function that can be passed in (with a default)? I am thinking here about symplectic methods for differential equations. Also we ought to be able to estimate the error for given methods anyway (although a test is also nice). There will be a performance / accuracy pay-off of course. |
Luckily I found this https://github.com/ivanperez-keera/dunai/issues?q=is%3Aissue+is%3Aclosed. Without it the bouncing ball does not bounce for long.
EDIT (by Ivan Perez): This issue has been transferred from the dunai repo to the Yampa repo.
The text was updated successfully, but these errors were encountered: