0
$\begingroup$

If I have the following Hamiltonian:

1/2 k q[t]^2 + Derivative[1][q][t] (m Derivative[1][q][t] + y q[t]) - 
1/2 m Derivative[1][q][t]^2 - y q[t] Derivative[1][q][t] 

and I have for p:

p = y q[t] + m Derivative[1][q][t]

How can I substitute p in order to eliminate q'[t]?

$\endgroup$
  • $\begingroup$ H /. q'[t] -> (p - y q[t])/m? But I'm not sure what is the final goal. $\endgroup$ – Kuba Feb 19 '15 at 12:12
  • $\begingroup$ See a closely related problem encountered when one deals with systems of differential equations Working with a system of differential equations that cannot be solved explicitly $\endgroup$ – Artes Feb 19 '15 at 12:56
  • $\begingroup$ I tried but it gaves me: 1/2 (k q[t]^2 + m Derivative[1][q][t]^2) $\endgroup$ – ame_math Feb 19 '15 at 14:09
  • $\begingroup$ This? :1/2 k q[t]^2 + Derivative[1][q][t] (m Derivative[1][q][t] + y q[t]) - 1/2 m Derivative[1][q][t]^2 - y q[t] Derivative[1][q][t] /. q'[t] -> (p - y q[t])/m $\endgroup$ – Kuba Feb 19 '15 at 14:18
  • $\begingroup$ Thank you, I solved. It didn't work because I previously defined p as: p := D[L, {Derivative[1][q][t]}] $\endgroup$ – ame_math Feb 19 '15 at 14:22
4
$\begingroup$

If you aim to exclude the derivative, try this:

     1/2 k q[t]^2 + Derivative[1][q][t] (m Derivative[1][q][t] + y q[t]) - 
   1/2 m Derivative[1][q][t]^2 - y q[t] Derivative[1][q][t] /. 
  q'[t] -> p/m - y/m*q[t] // Simplify

(* (p^2 - 2 p y q[t] + (k m + y^2) q[t]^2)/(2 m)  *)

If, on the other hand, you aim to exclude the q[t], try this:

1/2 k q[t]^2 + Derivative[1][q][t] (m Derivative[1][q][t] + y q[t]) - 
   1/2 m Derivative[1][q][t]^2 - y q[t] Derivative[1][q][t] /. 
  q -> (p - y/m*q'[#] &) // Simplify

(*  (k m^2 p^2 - 2 k m p y Derivative[1][q][t] + 
 k y^2 Derivative[1][q][t]^2 + m y^2 (q^\[Prime]\[Prime])[t]^2)/(2 m^2)   *)

Have fun!

$\endgroup$
  • $\begingroup$ @Kuba It should $\endgroup$ – Alexei Boulbitch Feb 19 '15 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.