home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / MCAD254.ZIP / APPL / SYSTEM.MCD < prev   
Encoding:
Text File  |  1988-07-22  |  2.1 KB  |  89 lines

  1. .MCD 20000 0
  2. .CMD PLOTFORMAT logs=0,0 subdivs=1,1 size=5,15 type=l
  3. .CMD FORMAT  rd=d ct=10 im=i et=3 zt=15 pr=3 mass length time charge
  4. .CMD SET ORIGIN 0
  5. .CMD SET TOL 0.001000
  6. .CMD MARGIN 0
  7. .CMD LINELENGTH 78
  8. .CMD SET PRNCOLWIDTH 8
  9. .CMD SET PRNPRECISION 4
  10. .TXT 0 42 1 39 
  11. a1,38,39,37
  12. Copyright (c) 1988 by MathSoft, Inc.
  13. .TXT 1 -41 1 45 
  14. a1,44,78,43
  15. SOLVING A SYSTEM OF DIFFERENTIAL EQUATIONS
  16. .TXT 0 80 1 13 
  17. a1,12,78,11
  18. /equations
  19. .TXT 2 -80 3 37 
  20. a3,36,35,97
  21. x and y are functions of the time 
  22. variable t, and F and G are the 
  23. derivatives dx/dt and dy/dt.
  24. .EQN 0 45 1 24 
  25. F(t,x,y)~1.5*x-x*y
  26. .EQN 2 0 1 25 
  27. G(t,x,y)~-3*y+2*x*y
  28. .EQN 4 -45 1 12 
  29. startt~0
  30. .EQN 0 15 1 11 
  31. endt~15
  32. .EQN 0 13 1 9 
  33. n~100
  34. .TXT 0 10 1 12 
  35. a1,11,40,10
  36. intervals
  37. .EQN 0 13 1 11 
  38. initx~1
  39. .EQN 0 12 1 11 
  40. inity~3
  41. .EQN 1 18 1 24 
  42. k1(t,x,y,h)~F(t,x,y)
  43. .EQN 1 -69 13 45 
  44. U&L&x[k,y[k,0{1,1,11,35,ll}@endt&startt&t[k
  45. .EQN 0 44 1 9 
  46. U=?
  47. .EQN 1 25 1 24 
  48. K1(t,x,y,h)~G(t,x,y)
  49. .EQN 2 0 1 69 
  50. k2(t,x,y,h)~F(t+.5*h,x+.5*h*k1(t,x,y,h),y+.5*h*K1(t,x,y,h))
  51. .TXT 1 -81 2 12 
  52. a2,11,77,19
  53. graph of
  54. solution
  55. .EQN 1 81 1 69 
  56. K2(t,x,y,h)~G(t+.5*h,x+.5*h*k1(t,x,y,h),y+.5*h*K1(t,x,y,h))
  57. .EQN 2 0 1 69 
  58. k3(t,x,y,h)~F(t+.5*h,x+.5*h*k2(t,x,y,h),y+.5*h*K2(t,x,y,h))
  59. .EQN 2 0 1 69 
  60. K3(t,x,y,h)~G(t+.5*h,x+.5*h*k2(t,x,y,h),y+.5*h*K2(t,x,y,h))
  61. .EQN 1 -25 1 10 
  62. L=?
  63. .EQN 1 25 1 60 
  64. k4(t,x,y,h)~F(t+h,x+h*k3(t,x,y,h),y+h*K3(t,x,y,h))
  65. .EQN 2 0 1 60 
  66. K4(t,x,y,h)~G(t+h,x+h*k3(t,x,y,h),y+h*K3(t,x,y,h))
  67. .EQN 2 0 3 77 
  68. rk(t,x,y,h)~h/6*(k1(t,x,y,h)+2*k2(t,x,y,h)+2*k3(t,x,y,h)+k4(t,x,y,h))
  69. .EQN 4 0 3 77 
  70. rK(t,x,y,h)~h/6*(K1(t,x,y,h)+2*K2(t,x,y,h)+2*K3(t,x,y,h)+K4(t,x,y,h))
  71. .EQN 3 33 3 19 
  72. h~(endt-startt)/n
  73. .EQN 1 -33 1 15 
  74. j~0;n-1
  75. .EQN 0 17 2 13 
  76. t[0~startt
  77. .EQN 0 40 2 15 
  78. t[(j+1)~t[j+h
  79. .EQN 3 -57 4 16 
  80. ({2,1}÷y[0÷x[0)~({2,1}÷inity÷initx)
  81. .EQN 0 27 4 32 
  82. ({2,1}÷y[(j+1)÷x[(j+1))~({2,1}÷y[j+rK(t[j,x[j,y[j,h)÷x[j+rk(t[j,x[j,y[j,h))
  83. .EQN 5 -27 1 51 
  84. L~floor(if(min(x)<min(y),min(x),min(y))-.5)
  85. .EQN 0 63 1 11 
  86. k~0;n
  87. .EQN 1 -63 1 50 
  88. U~ceil(if(max(x)>max(y),max(x),max(y))+.5)
  89.