-
Notifications
You must be signed in to change notification settings - Fork 70
Coefficients for Cohen-Hubbard-Oesterwinter #1733
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
Conversation
// Definition of a Cohen-Hubbard-Oesterwinter formula. |order_| is the order of | ||
// the approximation, that is, the error on the derivative is h^(order + 1). | ||
// The formula requires |order_| values of the acceleration. numerators[0] | ||
// corresponds to f"(x₀), numerators[1] to f"(x₋₁), etc. |
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.
Use ″.
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.
Done.
using numerics::FixedVector; | ||
|
||
// Definition of a Cohen-Hubbard-Oesterwinter formula. |order_| is the order of | ||
// the approximation, that is, the error on the derivative is h^(order + 1). |
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.
O()?
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.
Done.
// the approximation, that is, the error on the derivative is h^(order + 1). | ||
// The formula requires |order_| values of the acceleration. numerators[0] | ||
// corresponds to f"(x₀), numerators[1] to f"(x₋₁), etc. | ||
// TODO(phl): This struct shows up in many places. Factor it out. |
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.
I don’t understand this TODO.
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.
We have 3 or 4 occurrences of a struct containing a FixedVector
for numerators and a single value for the denominator.
|
||
using numerics::FixedVector; | ||
|
||
// Definition of a Cohen-Hubbard-Oesterwinter formula. |order_| is the order of |
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.
Cite the paper, document any notational differences from the paper (I think we're off-by-one compared to it?)
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.
Done.
|
||
|
||
(fs[-h,\[ScriptCapitalN]+3]-fs[-2h,\[ScriptCapitalN]+3])/h+h Sum[f2s[-i h,\[ScriptCapitalN]+3]\[Beta][[i]],{i,1,Length[\[Beta]]}]//Expand | ||
ReleaseHold[Hold[(fs[-h,\[ScriptCapitalN]+3]-fs[-2h,\[ScriptCapitalN]+3])/h+h Sum[f2s[-i h,\[ScriptCapitalN]+3]\[Beta][\[ScriptCapitalN]][[i]],{i,1,Length[\[Beta][\[ScriptCapitalN]]]}]]/.\[ScriptCapitalN]->14]//Expand |
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.
What is going on with this ReleaseHold and Hold?
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.
Mathematica magic: (1) Hold prevents the functions like fs
from being evaluated at a place (2) N
is being substituted in the argument of fs
et al. (3) releasing the hold causes the whole thing to evaluate.
|
||
// Definition of a Cohen-Hubbard-Oesterwinter formula. |order_| is the order of | ||
// the approximation, that is, the error on the derivative is h^(order + 1). | ||
// The formula requires |order_| values of the acceleration. numerators[0] |
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.
Document what the formula is, and what it approximates.
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.
Done.
and a fix for the order of the backward difference method.