0
$\begingroup$

I have a parametric equation $r(t) = \left< 5\cos t, 5\sin t \right>$ from $t = 1$ to $t = 200$

I want to numerally compute the first derivative (velocity), and I am left with 199 data points only. Where should I put the first data point of the velocity if I use the definition $r'(t) = \displaystyle\frac{r(t+h) - r(t)}{h}$? Do I put it in the line $t = 1$ or in line $t=2$?

What happens if I use the central difference method? (For example: $r'(3) = \frac{r(4)-r(2)}{4-2}$, how will I deal with the endpoints?)

$\endgroup$
2
  • $\begingroup$ Are you certain that "from $t = 1$ to $t = 200$" means $t$ only takes integer values? $\endgroup$
    – Arthur
    Commented Nov 6, 2017 at 7:47
  • $\begingroup$ Did you mean from 1 to 200 degrees in a circle of 360 degrees? $\endgroup$ Commented Nov 6, 2017 at 8:37

1 Answer 1

2
$\begingroup$

You are right that the best choice among the simple difference quotients is the central difference quotient with error order 2. For the interval end, for instance the left, use $$ \frac{f(t+h)-f(t)}{h}=f'(t)+\frac h2f''(t)+O(h^2)=f'(t)+\frac h2f''(t+h)+O(h^2) \\ =f'(t)+\frac h2\frac{f(t+2h)-2f(t+h)+f(t)}{h^2}+O(h^2) $$ so that $$ f'(t)=\frac{-f(t+2h)+4f(t+h)-3f(t)}{2h}+O(h^2) $$ has also error order 2. Similarly for the right side, just replace $h$ by $-h$.

$\endgroup$
2
  • $\begingroup$ This is a nice shortcut for the one sided approximation. I have always expanded $f(x+h)$ and $f(x+2h)$ and solved for the weights. $\endgroup$ Commented Nov 6, 2017 at 9:08
  • $\begingroup$ Thanks for this. I forgot to ask about the case of $f''(x)$ (as an endpoint) $\endgroup$
    – cgo
    Commented Nov 6, 2017 at 12:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .