Question: problem with differentiation

i need to differentiate this equation 

Potential energy eq:
p := (m1*a1 + m2*(a123 + z(t)))*sin(theta(t))*g + m3*(sin(theta(t))*(a1234 + z(t)) + cos(theta(t))*a5)*g;


  p := (m1 a1 + m2 (a123 + z(t))) sin(theta(t)) g    + m3 (sin(theta(t)) (a1234 + z(t)) + cos(theta(t)) a5) g

i have tried these 2 methods

diff(p, theta)

diff(p, theta(t))

but both of them comes out 0 

where they should give 

diff((m1*a1 + m2*(a123 + z))*sin(theta)*g + m3*(sin(theta)*(a1234 + z) + cos(theta)*a5)*g, theta);


       (m1 a1 + m2 (a123 + z)) cos(theta) g + m3 (cos(theta) (a1234 + z) - sin(theta) a5) g

how is the syntax for partial differentiating a pre defined equation dependent on time.

Please Wait...