home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / demo / ode.zoo / heat.ode < prev    next >
Text File  |  1990-01-08  |  593b  |  32 lines

  1. # HEAT.ODE
  2. # This file demostrates how to solve a partial differential equation, in this
  3. # case the heat equation, with ODE.
  4. # We use finite differences for the second-order space derivatives.
  5. # We solve on a circle, with a source of heat at one point.
  6. # Plot any u variable against time.
  7.  
  8. $f 0
  9. $t 50
  10.  
  11. # intital values
  12. u1 = 0
  13. u2 = 0
  14. u3 = 0
  15. u4 = 0
  16. u5 = 1
  17. u6 = 0
  18. u7 = 0
  19. u8 = 0
  20. u9 = 0
  21.  
  22. # differential equations
  23. u1' = u2-2*u1+u9
  24. u2' = u3-2*u2+u1
  25. u3' = u4-2*u3+u2
  26. u4' = u5-2*u4+u3
  27. u5' = u6-2*u5+u4
  28. u6' = u7-2*u6+u5
  29. u7' = u8-2*u7+u6
  30. u8' = u9-2*u8+u7
  31. u9' = u1-2*u9+u8
  32.