higher derivatives

2544 days ago by chrisphan

x = var('x') def f(x): return exp(-x/8)*sin(x) fgraph = plot(f(x), x, 0, 5*pi, rgbcolor=(0, 1, 0)) a(x) = diff(f(x),x) agraph = plot(a(x), x, 0, 5*pi, rgbcolor=(0, 1, 0)) b(x) = diff(a(x),x) bgraph = plot(b(x), x, 0, 5*pi, rgbcolor=(0, 1, 0)) c(x) = diff(b(x),x) cgraph = plot(c(x), x, 0, 5*pi, rgbcolor=(0, 1, 0)) html('The first three derivatives of $f(x) = e^{-x/8} \sin x$, and the tangent lines at $u$.') @interact def tanglines(u=slider(0, 5*pi, 0.1)): orig = fgraph + plot(a(u)*(x-u) + f(u), 0, 5*pi, ymin=-1, ymax=1) + point([u,f(u)]) firstder = agraph + plot(b(u)*(x-u) + a(u), 0, 5*pi, ymin=-1, ymax =1) + point([u,a(u)]) secondder = bgraph + plot(c(u)*(x-u) + b(u), 0, 5*pi, ymin=-1, ymax =1) + point([u,b(u)]) thirdder = cgraph + point([u, c(u)]) html.table([[orig, firstder], [secondder, thirdder]]) 
       
The first three derivatives of f(x) = e^{-x/8} \sin x, and the tangent lines at u.

Click to the left again to hide and once more to show the dynamic interactive window