soliton.ode 432 B

1234567891011121314151617181920212223242526
  1. # You may run this example by doing:
  2. #
  3. # ode < soliton.ode | graph -T X -C
  4. #
  5. # or alternatively, to create a real-time plot,
  6. #
  7. # ode < soliton.ode | graph -T X -C -x 5 15 5 -y -3 3
  8. # This example numerically solves an initial value problem arising in
  9. # John Selker's soliton thesis:
  10. #
  11. # x'' = (2 / t) * x' + B * x
  12. # B = -1
  13. # x(5) = 0
  14. # x'(5) = 1
  15. x' = vx
  16. vx' = 2 / t * vx + B * x
  17. B = -1
  18. x = 0
  19. vx = 1
  20. print t, x
  21. step 5, 15