Skip to content

Commit

Permalink
Horner's method for Radau is not correct yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBreuling committed Jul 30, 2024
1 parent 8518e9c commit f19c6e1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions scipy_dae/integrate/_dae/radau.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ def _step_impl(self):
Z0 = np.zeros((s, y.shape[0]))
else:
Z0 = self.sol(t + h * C)[0].T - y
Z0 = np.zeros((s, y.shape[0]))
scale = atol + np.abs(y) * rtol

converged = False
Expand Down Expand Up @@ -719,10 +720,18 @@ def _call_impl(self, t):
# compute derivative of interpolation polynomial
yp = np.dot(self.Q, dp)

# # compute derivative of interpolation polynomial
# # compute both values by Horner's method:
# # https://cut-the-knot.org/Curriculum/Calculus/HornerMethod.shtml
# # https://math.stackexchange.com/questions/2139142/how-does-horner-method-evaluate-the-derivative-of-a-function
# y = np.zeros_like(y)
# y += self.Q[:, -1][:, None]
# yp = np.zeros_like(y)
# for i in range(self.order + 1):
# yp += np.outer(self.Q[:, i] * (i + 1), x**i) / self.h
# for i in range(self.order + 1, 1, -1):
# yp = y + yp * x[None, :]
# y = self.Q[:, i - 1][:, None] + y * x[None, :]

# # y += self.y_old[:, None]
# yp /= self.h

return y, yp

Expand Down

0 comments on commit f19c6e1

Please sign in to comment.