I'm creating an example for using SymPy, using the good old harmonic 
oscillator as an example:

import sympy
s = sympy.Function("s")
t, zeta, m, k = sympy.symbols("t, zeta, m, kappa")
expr = sympy.Eq(m*s(t).diff(t, t), -k*s(t))
sympy.dsolve(expr, s(t), ics={s(t).diff(t,1).subs(t,0):0})

The latex form of the output is:

s{\left (t \right )} = 
  C_{1} e^{- t \sqrt{- \frac{\kappa}{m}}} + 
  C_{2} e^{t \sqrt{- \frac{\kappa}{m}}}

This gives a nice and generic result, but a bit too generic to my taste. 
For instance the constants m and k are both positive, and with that 
knowledge it is easy to express teh result using sine and cosine functions 
(and with the constraint: only a cosine).

How do I tell SymPy that m and k are > 0?



You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to