-
-
Notifications
You must be signed in to change notification settings - Fork 236
Rkv76iia #2878
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
base: master
Are you sure you want to change the base?
Rkv76iia #2878
Conversation
Show plots of the convergence tests, just |
I will also take a look at the RKV76IIA algorithm's implementation to find out why the order of convergence is failing at smaller values of dt. If you have any suggestions as to what I should look for specifically, please let me know. |
Your plot is using too small dt for Float64 tolerance. you can see that it levels off at y=~1e-14 which is roughly floating point error. You should probably switch to using |
Yes it's just saturating because that is as accurate as Float64 can get. Doing this test in big float would let it keep going |
I tried to convert the errors obtained from the convergence test to BigFloat, but that did not help with the convergence. This is the output for the code: Out-of-place solution at t=1: 0.36787944117147253 Testing order 7: I also looked at some tests defined for OrdinaryDiffEqLowStorageRK, and I tried to write similar tests for the RKV76IIA method, but the code is generating this compilation error: RKV76IIa: Error During Test at OrdinaryDiffEq.jl/lib/OrdinaryDiffEqVerner/test/convergence_tests.jl:64 As far as I can see, it is not easy to convert the RKV76IIA algorithm to support BigFloat without major refactoring. Could you please provide specific guidance on how I can resolve the BigFloat issue and get the tests working? I am also attaching the code I have written as reference (convergence_test.txt). |
function RKV76IIaTableau(T::Type{<:CompiledFloats}, T2::Type{<:CompiledFloats}) | ||
# Nodes | ||
c1 = convert(T2, 0) | ||
c2 = convert(T2, 0.069) | ||
c3 = convert(T2, 0.118) | ||
c4 = convert(T2, 0.177) | ||
c5 = convert(T2, 0.501) | ||
c6 = convert(T2, 0.7737799115305331003715765296862487670813) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dispatch will only get the numbers in Float64, which is why it cuts off. For BigFloats dispatch, write it like this:
The reason is that machine floats are only 64-bit, so 0.01710144927536231884057971014492753623188
will automatically truncate to the Float64. You need to input it as a string and tell it to parse the string to a BigInt/BigFloat in order to force it to keep the full precision. That requires a separate dispatch because it's slower, so this one is hit for CompiledFloats (i.e. Float32, Float64) while the other will be for arbitrary other number types, like BigFloat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And leave the dispatch open there https://github.com/SciML/OrdinaryDiffEq.jl/blob/master/lib/OrdinaryDiffEqVerner/src/verner_tableaus.jl#L438
Checklist
Additional Notes
Order between dt=1//8 and dt=1//16: -0.7854954880938649
RKV76IIa Convergence Tests: Test Failed
Expression: ≈(order, 7, atol = testTol)
Evaluated: -0.7854954880938649 ≈ 7 (atol=0.3)
Order between dt=1//16 and dt=1//32: 1.5849625007211563
RKV76IIa Convergence Tests: Test Failed at C:\Users\srira\Downloads\Ordinary Differential Equations\OrdinaryDiffEq.jl\lib\OrdinaryDiffEqVerner\test\rkv76iia_tests.jl:73
Expression: ≈(order, 7, atol = testTol)
Evaluated: 1.5849625007211563 ≈ 7 (atol=0.3)
Order between dt=1//32 and dt=1//64: 0.967333811079678
RKV76IIa Convergence Tests: Test Failed at C:\Users\srira\Downloads\Ordinary Differential Equations\OrdinaryDiffEq.jl\lib\OrdinaryDiffEqVerner\test\rkv76iia_tests.jl:73
Expression: ≈(order, 7, atol = testTol)
Evaluated: 0.967333811079678 ≈ 7 (atol=0.3)