12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

differentiation & searching 147y(t)y(t)CentralForward0tt + h0t – h/2tt + h/2Figure 7.1 Forward-difference approximation (slanted dashed line) and central-differenceapproximation (horizontal line) for the numerical first derivative at point t. The centraldifference is seen to be more accurate. ( The trajectory is that of a projectile with airresistance.)7.2 Forward Difference (Algorithm)The most direct method for numerical differentiation starts by expanding a functionin a Taylor series to obtain its value a small step h away:y(t + h)=y(t)+h dy(t)dt+ h22!d 2 y(t)dt 2+ h33!dy 3 (t)dt 3 + ··· . (7.2)We obtain the forward-difference derivative algorithm by solving (7.2) for y ′ (t):dy(t)dt∣∣fddef=y(t + h) − y(t). (7.3)hAn approximation for the error follows from substituting the Taylor series:dy(t)dt∣ ≃ dy(t) + hfddt 2dy 2 (t)dt 2 + ··· . (7.4)You can think of this approximation as using two points to represent the functionby a straight line in the interval from x to x + h (Figure 7.1 left).The approximation (7.3) has an error proportional to h (unless the heavens lookdown upon you kindly and make y ′′ vanish). We can make the approximation errorsmaller by making h smaller, yet precision will be lost through the subtractivecancellation on the left-hand side (LHS) of (7.3) for too small an h. To see how−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 147

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!