Skip to content

Commit 2b1514b

Browse files
committed
splines already have a derivative implemented, so there isn't necessarily a need to FD on top of them
1 parent eda3aaf commit 2b1514b

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

examples/1_basic_tutorial.ipynb

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

examples/2a_optimizing_parameters_with_dxdt_known.ipynb

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

examples/2b_optimizing_parameters_with_dxdt_unknown.ipynb

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

pynumdiff/smooth_finite_difference/_smooth_finite_difference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def splinediff(x, dt, params=None, options={}, order=3, s=None, num_iterations=1
200200
spline = scipy.interpolate.UnivariateSpline(t, x_hat, k=order, s=s)
201201
x_hat = spline(t)
202202

203-
x_hat, dxdt_hat = finite_difference(x_hat, dt)
203+
dspline = spline.derivative()
204+
dxdt_hat = dspline(t)
204205

205206
return x_hat, dxdt_hat

pynumdiff/tests/test_diff_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def iterated_first_order(*args, **kwargs): return first_order(*args, **kwargs)
137137
[(1, 0), (1, 1), (1, 0), (1, 1)],
138138
[(2, 2), (3, 2), (2, 2), (3, 2)],
139139
[(2, 1), (3, 3), (2, 1), (3, 3)]],
140-
splinediff: [[(-14, -15), (-14, -14), (-1, -1), (0, 0)],
140+
splinediff: [[(-14, -15), (-14, -15), (-1, -1), (0, 0)],
141141
[(-14, -14), (-13, -14), (-1, -1), (0, 0)],
142142
[(-14, -14), (-13, -13), (-1, -1), (0, 0)],
143143
[(0, 0), (1, 1), (0, 0), (1, 1)],

0 commit comments

Comments
 (0)