conlaw.tst 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. off echo, dfprint$ % FJW
  2. %*******************************************************************%
  3. % %
  4. % CONLAW.TST contains test examples for the programs CONLAW1.RED %
  5. % CONLAW2.RED, CONLAW3.RED %
  6. % %
  7. % Author: Thomas Wolf %
  8. % Date: 1. Jan 1998 %
  9. % %
  10. % Details about the syntax of CONLAWi are given in CONLAW.TEX. %
  11. % To run this file read in or load CRACK, CONLAW0.RED before. %
  12. % %
  13. %*******************************************************************%
  14. lisp(depl!*:=nil)$ % clearing of all dependencies
  15. setcrackflags()$ % standart flags
  16. lisp(print_:=nil)$ % no output of the calculation
  17. lisp <<terpri()$write
  18. "If you want to see more details of the following calculation then"$
  19. terpri()$write"change in the file `conlaw.tst' the line"$
  20. terpri()$write" lisp(print_:=nil)$ "$
  21. terpri()$write"into"$
  22. terpri()$write" lisp(print_:=10)$ "$
  23. terpri()>>$
  24. lisp <<terpri()$write
  25. "**************************************************************************"$
  26. terpri()$terpri()$write
  27. "The following example calculates all conservation laws of the KdV-"$
  28. terpri()$write
  29. "equation with a characteristic function of order not higher than two"$
  30. terpri()>>$
  31. nodepnd {u}$ % deletes all dependencies of u
  32. depend u,x,t$ % declares u to be a function of x,t
  33. conlaw3({{df(u,t) = u*df(u,x)+df(u,x,3)}, {u}, {t,x}},
  34. {0, 2, t, {}, {}} )$
  35. lisp <<terpri()$write
  36. "**************************************************************************"$
  37. terpri()$terpri()$write
  38. "The next example demonstrates that one can specify an ansatz"$
  39. terpri()$write
  40. "for the characteristic function of one or more equations of the"$
  41. terpri()$write
  42. "PDE-system. In this example all conservation laws of the wave"$
  43. terpri()$write
  44. "equation which is written as a first order system are calculated"$
  45. terpri()$write
  46. "such that the characteristic functions of the first of both"$
  47. terpri()$write
  48. "equations is proportional to df(u,x,2). (This will include zero"$
  49. terpri()$write
  50. "as it is a multiple of df(u,x,2) too.)"$
  51. terpri()>>$
  52. comment
  53. In the following input the equations are solved for the t-derivatives,
  54. so the t-derivatives will be substituted in the conservation-law-
  55. conditions, so the ansatz for q_1 should have no t-derivatives of u
  56. included. Therefore the function r in q_1 below is specified as
  57. depending on t,x,u,v,df(u,x),df(v,x).
  58. In the call of conlaw2 the list of variables is {t,x} and x is
  59. the second of the variables (could equally well be in reverse order).
  60. Therefore df(u,x) takes the form u!`2 when the dependencies of r
  61. are specified (see CONLAW.TEX). $
  62. nodepnd {u,v,r}$
  63. depend u,x,t$
  64. depend v,x,t$
  65. depend r,t,x,u,v,u!`2,v!`2$
  66. q_1:=r*df(u,x,2)$
  67. conlaw2({{df(u,t)=df(v,x),
  68. df(v,t)=df(u,x) }, {u,v}, {t,x}},
  69. {2, 2, t, {r}, {}})$
  70. clear q_1$
  71. nodepnd {q_1}$
  72. lisp<<terpri()$write
  73. "**************************************************************************"$
  74. terpri()$terpri()$write
  75. "For the Burgers equation the following example finds all conservation"$
  76. terpri()$write
  77. "laws of zero'th order in the characteristic function up to the solution"$
  78. terpri()$write
  79. "of the linear heat equation. This is an example for what happens when not"$
  80. terpri()$write
  81. "all conditions could be solved, but it is also an example which shows"$
  82. terpri()$write
  83. "that not only characteristic functions of polynomial or rational form"$
  84. terpri()$write
  85. "can be found."$
  86. terpri()>>$
  87. nodepnd {u}$
  88. depend u,x,t$
  89. conlaw1({{df(u,t)=df(u,x,2)+df(u,x)**2/2}, {u}, {t,x}},
  90. {0, 0, t, {}, {}} )$
  91. lisp <<terpri()$write
  92. "**************************************************************************"$
  93. terpri()$terpri()$write
  94. "In this example all conservation laws of the Ito system are calculated"$
  95. terpri()$write
  96. "that have a conserved density of order not higher than one."$
  97. terpri()$write
  98. "This is a further example of non-polynomial conservation laws."$
  99. terpri()>>$
  100. nodepnd {u,v}$
  101. depend u,x,t$
  102. depend v,x,t$
  103. conlaw1({{df(u,t)=df(u,x,3)+6*u*df(u,x)+2*v*df(v,x),
  104. df(v,t)=2*df(u,x)*v+2*u*df(v,x) }, {u,v}, {t,x}},
  105. {0, 1, t, {}, {}})$
  106. lisp <<terpri()$write
  107. "**************************************************************************"$
  108. terpri()$terpri()$write
  109. "In the next example the 5th order Korteweg - de Vries equation is"$
  110. terpri()$write
  111. "investigated concerning conservation laws of order 0 and 1 in the"$
  112. terpri()$write
  113. "conserved density P_t. Parameters a,b,c in the PDE are determined"$
  114. terpri()$write
  115. "such that conservation laws exist. This complicates the problem by"$
  116. terpri()$write
  117. "making it non-linear with a number of cases to be considered."$
  118. terpri()$write
  119. "Some of the subcases below can be combined to reduce their number"$
  120. terpri()$write
  121. "which currently is not done automatically."$
  122. terpri()>>$
  123. nodepnd {u}$
  124. depend u,x,t$
  125. conlaw1({{df(u,t)=-df(u,x,5)-a*u**2*df(u,x)
  126. -b*df(u,x)*df(u,x,2)-c*u*df(u,x,3)},
  127. {u}, {t,x}},
  128. {0, 1, t, {a,b,c}, {}})$
  129. lisp <<terpri()$write
  130. "**************************************************************************"$
  131. terpri()$terpri()$write
  132. "CONLAWi can also be used to determine first integrals of ODEs."$
  133. terpri()$write
  134. "The generality of the ansatz is not just specified by the order."$
  135. terpri()$write
  136. "For example, the Lorentz system below is a first order system"$
  137. terpri()$write
  138. "therefore any first integrals are zero order expressions."$
  139. terpri()$write
  140. "The ansatz to be investigated below looks for first integrals of"$
  141. terpri()$write
  142. "the form a1(x,1)+a2(y,t)+a3(x,t)=const. and determines parameters"$
  143. terpri()$write
  144. "s,b,r such that first integrals exist."$
  145. terpri()>>$
  146. nodepnd {x,y,z,a1,a2,a3,b,s,r}$
  147. depend x,t$
  148. depend y,t$
  149. depend z,t$
  150. depend a1,x,t$
  151. depend a2,y,t$
  152. depend a3,z,t$
  153. p_t:=a1+a2+a3$
  154. conlaw1({{df(x,t) = - s*x + s*y,
  155. df(y,t) = x*z + r*x - y,
  156. df(z,t) = x*y - b*z},
  157. {x,y,z},{t}
  158. },
  159. {0,0,t,{a1,a2,a3,s,r,b},{}})$
  160. clear p_t$
  161. nodepnd {u,v,r,p_t,x,y,z,a1,a2,a3,b,s,r}$
  162. end$