CoCalc Shared FilesMTH 505 / sec_5_3_derivatives.sagews
Author: Jonathan Mitchell
Views : 163
# This is apparently a linked sage worksheet. So, copy/pasted what you want/need from here to YOUR OWN sage worksheet in cocalc. That way, we are not using the same worksheet at the same time.

t = var('t')
# declare y to be a function of t
function('y',nargs=1)(t)
f = y(t)*(t^2+1)
show("f(t,y) = ",f)
# Fp is the first derivative of f with respect to t
fp = diff(f,t,1)
eqns = [diff(y(t),t,1) == f]
Fp = fp.substitute(eqns)
show("1st derivative of f(t,y) wrt time = ", factor(Fp))


y(t)
f(t,y) = $\displaystyle {\left(t^{2} + 1\right)} y\left(t\right)$
1st derivative of f(t,y) wrt time = $\displaystyle {\left(t^{4} + 2 \, t^{2} + 2 \, t + 1\right)} y\left(t\right)$
# Fpp is the second derivative of f with respect to t
fpp = diff(Fp,t,1)
Fpp = fpp.substitute(eqns)
show("2nd derivative of f(t,y) wrt time = ",factor(Fpp))

2nd derivative of f(t,y) wrt time = $\displaystyle {\left(t^{6} + 3 \, t^{4} + 6 \, t^{3} + 3 \, t^{2} + 6 \, t + 3\right)} y\left(t\right)$
# Fppp is the third derivative of f with respect to t
fppp = diff(Fpp,t,1)
Fppp = fppp.substitute(eqns)
show("3rd derivative of f(t,y)  = ", factor(Fppp))

3rd derivative of f(t,y) = $\displaystyle {\left(t^{8} + 4 \, t^{6} + 12 \, t^{5} + 6 \, t^{4} + 24 \, t^{3} + 24 \, t^{2} + 12 \, t + 9\right)} y\left(t\right)$