# Differential system of equations in Sage

Greetings all!

This is a "how do I do it in Sage" question. Let's say I have the following system of differential equations:

(a, b, p, r, and h are ALL functions of t)

eqn1 = diff(a,t) == 3*p

eqn2 = diff(b,t) == 4 + r

eqn3 = h == a^2 + b^2

NOW, I want to differentiate h from equation three (using implicit differentiation).

The "answer" would be: diff(h,t) = 2 * a * diff(a,t) + 2 * b * diff(b,t) (note that we DO know what diff(a,t) and diff(b,t) are from eqn1 and eqn2)

--> How can I get sage to differentiate eqn3, AND plug in the equations from eqn1 and eqn2 for the time derivatives of a and b?