ORTHOVEC.LOG 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. REDUCE 3.6, 15-Jul-95, patched to 6 Mar 96 ...
  2. *** + redefined
  3. *** - redefined
  4. *** * redefined
  5. *** / redefined
  6. *** ^ redefined
  7. %===========================================
  8. %test file for ORTHOVEC version 2, June 1990
  9. %===========================================
  10. showtime;
  11. Time: 20 ms
  12. %example 1: vector identity
  13. a:=svec(a1,a2,a3);
  14. a := [a1,a2,a3]
  15. b:=svec(b1,b2,b3);
  16. b := [b1,b2,b3]
  17. c:=svec(c1,c2,c3);
  18. c := [c1,c2,c3]
  19. d:=svec(d1,d2,d3);
  20. d := [d1,d2,d3]
  21. a><b*c><d - (a*c)*(b*d) + (a*d)*(b*c);
  22. 0
  23. %showtime;
  24. %example 2: Equation of Motion in cylindricals
  25. vstart$
  26. Select Coordinate System by number
  27. 1] cartesian
  28. 2] cylindrical
  29. 3] spherical
  30. 4] general
  31. 5] others
  32. 2
  33. coordinate type = 2
  34. coordinates = r,th,z
  35. scale factors = 1,r,1
  36. v:=svec(vr,vt,vz)$
  37. b:=svec(br,bt,bz)$
  38. depend v,r,th,z$
  39. depend b,r,th,z$
  40. depend p,r,th,z$
  41. eom:=vout( vdf(v,tt) + v dotgrad v + grad(p) - curl(b) >< b )$
  42. [1] ( - df(br,th)*bt - df(br,z)*bz*r + df(bt,r)*bt*r + df(bz,r)*bz*r + df(p,r)*r
  43. 2 2
  44. + df(vr,r)*r*vr + df(vr,th)*vt + df(vr,z)*r*vz + bt - vt )/r
  45. [2] (df(br,th)*br - df(bt,r)*br*r - df(bt,z)*bz*r + df(bz,th)*bz + df(p,th)
  46. + df(vt,r)*r*vr + df(vt,th)*vt + df(vt,z)*r*vz - br*bt + vr*vt)/r
  47. [3] (df(br,z)*br*r + df(bt,z)*bt*r - df(bz,r)*br*r - df(bz,th)*bt + df(p,z)*r
  48. + df(vz,r)*r*vr + df(vz,th)*vt + df(vz,z)*r*vz)/r
  49. %showtime;
  50. %example 3: Taylor expansions
  51. on div;
  52. on revpri;
  53. vtaylor(sin(x)*cos(y)+e**z,svec(x,y,z),svec(0,0,0),svec(3,4,5));
  54. 1 2 1 3 1 4 1 5 1 2 1 4 1 3
  55. 1 + z + ---*z + ---*z + ----*z + -----*z + x - ---*x*y + ----*x*y - ---*x
  56. 2 6 24 120 2 24 6
  57. 1 3 2 1 3 4
  58. + ----*x *y - -----*x *y
  59. 12 144
  60. vtaylor(sin(x)/x,x,0,5);
  61. 1 2 1 4
  62. 1 - ---*x + -----*x
  63. 6 120
  64. te:=vtaylor(svec(x/sin(x),(e**y-1)/y,(1+z)**10),svec(x,y,z),
  65. svec(0,0,0),5);
  66. 2 4 2 3 4 5
  67. 360 + 60*x + 7*x 720 + 360*y + 120*y + 30*y + 6*y + y
  68. te := [--------------------,------------------------------------------,1 + 10*z
  69. 360 720
  70. 2 3 4 5
  71. + 45*z + 120*z + 210*z + 252*z ]
  72. %showtime;
  73. %example 4: extract components
  74. eom _2;
  75. -1 -1 -1
  76. r *vr*vt - br*bt*r + df(vt,z)*vz + df(vt,th)*r *vt + df(vt,r)*vr
  77. -1 -1
  78. + df(p,th)*r + df(bz,th)*bz*r - df(bt,z)*bz - df(bt,r)*br
  79. -1
  80. + df(br,th)*br*r
  81. te _1;
  82. 1 2 7 4
  83. 1 + ---*x + -----*x
  84. 6 360
  85. off div;
  86. off revpri;
  87. %showtime;
  88. %example 5: Line Integral
  89. vstart$
  90. Select Coordinate System by number
  91. 1] cartesian
  92. 2] cylindrical
  93. 3] spherical
  94. 4] general
  95. 5] others
  96. 1
  97. coordinate type = 1
  98. coordinates = x,y,z
  99. scale factors = 1,1,1
  100. dlineint(svec(3*x**2+5*y,-12*y*z,2*x*y*z**2),svec(s,s**2,s**3),s,1,2);
  101. 68491
  102. -------
  103. 42
  104. %showtime;
  105. %example 6: Volume Integral
  106. ub:=sqrt(r**2-x**2)$
  107. 8 * dvolint(1,svec(0,0,0),svec(r,ub,ub),6);
  108. 3
  109. 16*r
  110. -------
  111. 3
  112. %===========================================
  113. % end of test
  114. %===========================================
  115. showtime;
  116. Time: 1290 ms plus GC time: 60 ms
  117. ;
  118. end;
  119. (TIME: orthovec 1330 1390)