changevr.log 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. Codemist Standard Lisp 3.54 for DEC Alpha: May 23 1994
  2. Dump file created: Mon May 23 10:39:11 1994
  3. REDUCE 3.5, 15-Oct-93 ...
  4. Memory allocation: 6023424 bytes
  5. +++ About to read file tstlib.red
  6. %*********************************************************************;
  7. % This is a test file for the CHANGEVAR package. ;
  8. % Make sure that before you attempt to run it the ;
  9. % MATRIX package and CHANGEVAR is loaded. ;
  10. %*********************************************************************;
  11. algebraic;
  12. %*********************************************************************;
  13. % ON DISPJACOBIAN; % To get the Jacobians printed, remove the... ;
  14. % ... percentage sign before the word ON ;
  15. %*********************************************************************;
  16. % ;
  17. % *** First test problem *** ;
  18. % ;
  19. % Here are two Euler type of differential equations, ;
  20. % ;
  21. % 3 2 ;
  22. % 2 x y''' + 3 x y'' - y = 0 ;
  23. % ;
  24. % ;
  25. % 2 ;
  26. % 5 x y'' - x y' + 7 y = 0 ;
  27. % ;
  28. % ;
  29. % An Euler equation can be converted into a (linear) equation with ;
  30. % constant coefficients by making change of independent variable: ;
  31. % ;
  32. % u ;
  33. % x = e ;
  34. % ;
  35. % The resulting equations will be ;
  36. % ;
  37. % ;
  38. % 2 y''' - 3 y'' + y' - y = 0 ;
  39. % ;
  40. % and ;
  41. % ;
  42. % 5 y'' - 6 y' + 7 y = 0 ;
  43. % ;
  44. % ;
  45. % Where, now (prime) denotes differentiation with respect to the new ;
  46. % independent variable: u ;
  47. % How this change of variable is done using CHANGEVAR follows. ;
  48. % ;
  49. %*********************************************************************;
  50. operator y;
  51. changevar(y, u, x=e**u, { 2*x**3*df(y(x),x,3)+3*x**2*df(y(x),x,2)-y(x),
  52. 5*x**2*df(y(x),x,2)-x*df(y(x),x)+7*y(x) } ) ;
  53. {2*df(y(u),u,3) - 3*df(y(u),u,2) + df(y(u),u) - y(u),
  54. 5*df(y(u),u,2) - 6*df(y(u),u) + 7*y(u)}
  55. %*********************************************************************;
  56. % *** Second test problem *** ;
  57. % ;
  58. % Now, the problem is to obtain the polar coordinate form of Laplace's;
  59. % equation: ;
  60. % ;
  61. % 2 2 ;
  62. % d u d u ;
  63. % ------ + ------ = 0 ;
  64. % 2 2 ;
  65. % d x d y ;
  66. % ;
  67. % (The differentiations are partial) ;
  68. % ;
  69. % For polar coordinates the change of variables are : ;
  70. % ;
  71. % x = r cos(theta) , y = r sin(theta) ;
  72. % ;
  73. % As known, the result is : ;
  74. % ;
  75. % ;
  76. % 2 2 ;
  77. % d u 1 d u 1 d u ;
  78. % ------ + --- ------ + --- ---------- = 0 ;
  79. % 2 r d r 2 2 ;
  80. % d r r d theta ;
  81. % ;
  82. % How this change of variable is done using CHANGEVAR follows. ;
  83. % ;
  84. % 2 2 ;
  85. % (To get rid of the boring sin + cos terms we introduce a LET ;
  86. % statement) ;
  87. % ;
  88. %*********************************************************************;
  89. operator u;
  90. let sin theta**2 = 1 - cos theta**2 ;
  91. changevar(u, { r , theta }, { x=r*cos theta, y=r*sin theta },
  92. df(u(x,y),x,2)+df(u(x,y),y,2) ) ;
  93. 2
  94. df(u(r,theta),r,2)*r + df(u(r,theta),r)*r + df(u(r,theta),theta,2)
  95. ---------------------------------------------------------------------
  96. 2
  97. r
  98. end;
  99. (changevr 300 0)
  100. End of Lisp run after 0.31+0.68 seconds