Skip to content

Conversation

@KeshavVenkatesh
Copy link
Contributor

In this PR, I have attempted to implement the butcher tableau approach for the Tsit5 algorithm for both solving and interpolation.

I have used the coefficient values from OrdinaryDiffEqExplicitRK. I am working on extending the benchmark tests for interpolation.

Please review my changes and provide feedback for the following:

  • On the implementation for solving and interpolation.
  • The logic for benchmark tests, results and suggestions on how I can improve them. Are the numerical differences in values between two approaches acceptable?
  • Suggestions for how I can extend the benchmark tests for interpolations as well.

@KeshavVenkatesh
Copy link
Contributor Author

@ChrisRackauckas : Request you to kindly review this PR and provide your feedback

Comment on lines 1 to 8
"""
Evaluate a polynomial at Θ, given coefficients for Θ¹, Θ², ..., Θ⁶.
Assumes coeffs = [a₁, a₂, ..., a₆] for Θ¹, Θ², ..., Θ⁶.
"""
function eval_poly_theta(Θ, coeffs)
# coeffs[1]*Θ + coeffs[2]*Θ^2 + ... + coeffs[6]*Θ^6
return sum(coeffs[i] * Θ^i for i in 1:length(coeffs))
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this just evalpoly?

[@evalpoly(Θ, tableau[i,:]...) for i in 1:num_stages]
else
# For derivative: d/dΘ [a₀ + a₁*Θ + a₂*Θ² + ...] = a₁ + 2*a₂*Θ + 3*a₃*Θ² + ...
[@evalpoly(Θ, [j * tableau[i, j+1] for j in 1:(num_coeffs-1)]...) for i in 1:num_stages]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oscardssmith : Thanks for the feedback and suggestion. Apologies I was not familiar with this. Could you please check if this change looks right?

@ChrisRackauckas
Copy link
Member

Sorry was trying to get this repo passing tests again first.

This should just be added as part of the normal ExplicitRK implementation. With a field for the interpolation values added to the ExplicitRKTableau definition in DiffEqBase.

Note this is the same tableau as the one that is tested https://github.com/SciML/DiffEqDevTools.jl/blob/master/src/ode_tableaus.jl#L989

@KeshavVenkatesh
Copy link
Contributor Author

Thank you for these updates. I will work on what you said and send you a new PR tomorrow.

@KeshavVenkatesh
Copy link
Contributor Author

KeshavVenkatesh commented Dec 18, 2025

@ChrisRackauckas Could you please review the changes I have made? I will do some more testing, but I wanted to know if I have incorporated your suggestions. I have also created a new PR in DiffEqBase, can you please review that as well? Thanks!

@ChrisRackauckas
Copy link
Member

all of the generic_dense parts are missing?

@KeshavVenkatesh
Copy link
Contributor Author

all of the generic_dense parts are missing?

@ChrisRackauckas Does this involve implementing equivalent logic as in

@muladd function _ode_interpolant(Θ, dt, y₀, y₁, k, cache::Tsit5ConstantCache,

@ChrisRackauckas
Copy link
Member

Yes exactly, just for the ExplicitRK tableau with its generic coefficient vector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants