aherbert commented on code in PR #225:
URL: https://github.com/apache/commons-math/pull/225#discussion_r1002386033
##########
commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ode/nonstiff/HighamHall54StepInterpolator.java:
##########
@@ -100,9 +103,9 @@ protected void computeInterpolatedStateAndDerivatives(final
double theta,
} else {
final double theta2 = theta * theta;
final double b0 = h * (-1.0/12.0 + theta * (1.0 + theta * (-15.0/4.0 +
theta * (16.0/3.0 + theta * -5.0/2.0))));
- final double b2 = h * (-27.0/32.0 + theta2 * (459.0/32.0 + theta *
(-243.0/8.0 + theta * 135.0/8.0)));
- final double b3 = h * (4.0/3.0 + theta2 * (-22.0 + theta * (152.0/3.0
+ theta * -30.0)));
- final double b4 = h * (-125.0/96.0 + theta2 * (375.0/32.0 + theta *
(-625.0/24.0 + theta * 125.0/8.0)));
+ final double b2 = h * (-27.0/32.0 + theta2 * v);
Review Comment:
I do not mind the duplicate code. I am assuming this has been written based
on a known method for the 5(4) Higham and Hall integrator and would be
recognisable when compared to the original source.
However it can be improved with better formatting within the else block:
```Java
final double b0 = h * (-1.0/12.0 + theta * (1.0 + theta *
(-15.0/4.0 + theta * (16.0/3.0 + theta * -5.0/2.0))));
final double b2 = h * (-27.0/32.0 + theta2 * (459.0/32.0 + theta *
(-243.0/8.0 + theta * 135.0/8.0)));
final double b3 = h * (4.0/3.0 + theta2 * (-22.0 + theta *
(152.0/3.0 + theta * -30.0)));
final double b4 = h * (-125.0/96.0 + theta2 * (375.0/32.0 + theta *
(-625.0/24.0 + theta * 125.0/8.0)));
final double b5 = h * (-5.0/48.0 + theta2 * (-5.0/16.0 + theta *
5.0/12.0));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]