Guest User

Untitled

a guest
Nov 14th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import sympy as sp
  2. print('sympy version:', sp.__version__)
  3.  
  4. t = sp.symbols('t', real=True, nonnegative=True)
  5. n = sp.symbols('n', integer=True, nonnegative=True)
  6. f = sp.symbols('f', cls=sp.Function)
  7.  
  8. diff_eq = sp.Eq(f(t).diff(t, 2) + n**2*f(t), 0)
  9.  
  10. print('general solution:', sp.dsolve(diff_eq, f(t)))
  11. print('solution at n=0 (pre-subs):', sp.dsolve(diff_eq.subs(n, 0), f(t)))
  12. print('solution at n=0 (post-subs):', sp.dsolve(diff_eq, f(t)).subs(n, 0))
Add Comment
Please, Sign In to add comment