crack.rlg 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. Tue Feb 10 12:26:52 2004 run on Linux
  2. %*******************************************************************%
  3. % %
  4. % C R A C K . T S T %
  5. % ----------------- %
  6. % crack.tst contains test examples for the program crack.red. %
  7. % %
  8. % Author of this file: Thomas Wolf %
  9. % Date: 11. Sep 1998, 6. May 2003 %
  10. % %
  11. % Details about the syntax of crack.red are given in crack.tex. %
  12. % %
  13. % To run this demo you need to load crack through: %
  14. % load crack$ %
  15. % and to read in this file as %
  16. % in "crack.tst"; %
  17. % If you got the source code of a newer version of crack then %
  18. % either read it in through %
  19. % in "crack.red"$ %
  20. % (with the appropriate directory name in front of crack.red) %
  21. % or, to speed up the calculation, you compile before with %
  22. % faslout "crack"$ %
  23. % in "crack.red"$ %
  24. % faslend$ %
  25. % and then load it with %
  26. % load crack$ %
  27. % %
  28. %*******************************************************************%
  29. lisp(depl!*:=nil)$
  30. % clearing of all dependencies
  31. setcrackflags()$
  32. % use standart flag-setting
  33. %lisp(print_:=50)$ % if one would want to print expressions
  34. % with up to 50 factors
  35. lisp(print_:=nil)$
  36. % to suppress printing the computation
  37. lisp(initial_proc_list_ := % initial_proc_list_ is saved for an
  38. proc_list_)$
  39. % application at the end
  40. on dfprint$
  41. % to print partial deriv. as indices
  42. %off batch_mode$
  43. comment
  44. -------------------------------------------------------
  45. Modules in CRACK
  46. The following examples illustrate the operation of various
  47. modules of CRACK. These examples are not typical applications
  48. but are chosen to demonstrate individual CRACK modules.
  49. To see typical applications of CRACK run LIEPDE.TST,
  50. CONLAW.TST or APPLYSYM.TST instead.
  51. The extra assignments in this run that involve proc_list_
  52. are to disable all other modules and to demonstrate better
  53. the action of the individual module.
  54. -------------------------------------------------------
  55. Format of the return of CRACK
  56. CRACK returns a list {sol_1,...} of one or more solutions
  57. where each solution is a list:
  58. { list_of_remaining_unsolved_equations,
  59. list_of_computed_values_of_functions_or_constants,
  60. list_of_free_functions_or_constants,
  61. list_of_inequalities_valid_for_this_solution }
  62. Empty lists are {}.
  63. =======================================================;
  64. write" Integration: Integrating exact PDEs "$
  65. Integration: Integrating exact PDEs
  66. comment
  67. An important part of CRACK are integration routines
  68. which employ a number of different techniques which
  69. are demonstrated next. At first an example for the
  70. integration of exact PDE;
  71. depend f,x,y$
  72. depend g,x$
  73. de:=2*df(f,y)*df(g,x) + 2*df(f,x,y)*g + g*df(g,x)**3 +
  74. x*df(g,x)**4 + 3*x*g*df(g,x)**2*df(g,x,2)$
  75. lisp(proc_list_ := '(integration))$
  76. crack({de},{},{f,g},{});
  77. 3
  78. {{{g *g*x*y + c_1 + c_2 + 2*f*g},
  79. x
  80. {},
  81. {g,f,c_2,c_1},
  82. {}}}
  83. write"-------------------------------------------------------"$
  84. -------------------------------------------------------
  85. write" Integration: Integration of an exact PDE + terms "$
  86. Integration: Integration of an exact PDE + terms
  87. write" which are not exact (are not a total "$
  88. which are not exact (are not a total
  89. write" derivative) but which only involve "$
  90. derivative) but which only involve
  91. write" unknown functions of fewer variables"$
  92. unknown functions of fewer variables
  93. comment
  94. The price of integrating non-exact expressions will be
  95. the introduction of extra conditions but in fewer variables
  96. than the integrated PDE has. A special algorithm minimizes
  97. the number of new functions of fewer variables to be
  98. introduced. The bracket below is a polynomial in the
  99. integration variable x, as a consequence the algorithm
  100. is applicable such that only one extra function has to be
  101. introduced. $
  102. de:=de + g^2*(y^2 + x*sin y + x^2*exp y)$
  103. crack({de},{},{f,g},{});
  104. 2
  105. {{{c_3 - g ,
  106. 3x
  107. y 2 3 y
  108. 3*cos(y)*c_3 *x - 3*cos(y)*c_3 - 3*e *c_3 *x - c_3 *y + 6*e *c_3 *x
  109. 2x x 2x 2x x
  110. 3 y
  111. - 3*g *g*x*y - 6*e *c_3 - 3*c_4 - 3*c_5 - 6*f*g},
  112. x
  113. {},
  114. {g,
  115. f,
  116. c_5,
  117. c_4,
  118. c_3},
  119. {}}}
  120. nodepnd {f,g}$
  121. write"-------------------------------------------------------"$
  122. -------------------------------------------------------
  123. write" Integration: Integrating Factors"$
  124. Integration: Integrating Factors
  125. comment
  126. Heuristics for the determination of integrating factors
  127. in CRACK are not rigorous but often useful. $
  128. depend f,x,y$
  129. g:=df(f,x)/e**x+df(f,y)/x**2$
  130. crack({num(df(g,x))},{},{f},{});
  131. 2 x x 2
  132. {{{f *x + e *f + e *c_6*x },
  133. x y
  134. {},
  135. {f,c_6},
  136. {}}}
  137. clear g$
  138. nodepnd {f}$
  139. write"-------------------------------------------------------"$
  140. -------------------------------------------------------
  141. write" Integration: Recognizing a 2-dim divergence"$
  142. Integration: Recognizing a 2-dim divergence
  143. comment
  144. Being able to recognize a structure 0=df(a,x)+df(b,y)
  145. where a,b are differential expressions is of benefit
  146. if a,b can both be solved for a unknown function as
  147. in the following example. $
  148. lisp(proc_list_ := '(subst_level_4 integration))$
  149. depend f,x,y$
  150. depend g,x,y$
  151. depend h,x,y$
  152. a:=x*f+y*df(g,y)$
  153. b:=df(g,x,y)*sin(x)+h/y$
  154. crack({df(a,x)+df(b,y)},{},{f,g,h},{});
  155. {{{},
  156. {h=cos(x)*g *y + c_7 *y,
  157. y x
  158. - c_7 - g *sin(x) - g *y
  159. y 2y y
  160. f=-----------------------------},
  161. x
  162. {g,c_7},
  163. {}}}
  164. nodepnd {f,g,h}$
  165. write"-------------------------------------------------------"$
  166. -------------------------------------------------------
  167. write" Integration: Solving ODEs for partial derivatives"$
  168. Integration: Solving ODEs for partial derivatives
  169. comment
  170. In CRACK ODEs and PDEs which are ODEs for a single partial
  171. derivative are investigated by the program ODESOLVE by
  172. MacCallum/Wright. In the following example this technique
  173. together with a previous one are successful. $
  174. depend f,x,y$
  175. lisp(proc_list_ := '(subst_level_4 integration))$
  176. crack({x**2*df(f,x,2,y)-2*x*df(f,x,y)-df(f,y)+x**3/y**2},
  177. {},{f},{});
  178. {{{},
  179. sqrt(13)*log(x) sqrt(13)/2 sqrt(13)/2 3
  180. {f=(sqrt(x)*e *c_10*x*y - x *c_12*y - x *x
  181. sqrt(13)/2
  182. + sqrt(x)*c_11*x*y)/(x *y)},
  183. {c_12,c_11,c_10},
  184. {}}}
  185. nodepnd {f}$
  186. write"======================================================="$
  187. =======================================================
  188. write" Separation: Direct separation of PDEs"$
  189. Separation: Direct separation of PDEs
  190. comment
  191. Another important group of modules concerns separations.
  192. In this example z is an extra independent variable on which
  193. f and g do not depend (therefore z is in the 4th argument
  194. to crack). There is furthermore a function h=h(z) which
  195. is assumed to be given and is not to be calculated as it
  196. is not element of the third argument to CRACK, i.e. the
  197. question is to find expressions for f,g for arbitrary h.
  198. In the computation below, h is treated as being linear
  199. independent from z because h is declared as arbitrary.
  200. If h would be added to the list {f,g} then h would have
  201. to be computed and direct separation would not be possible
  202. but only indirect separation (see next example). $
  203. depend f,x$
  204. depend g,y$
  205. depend h,z$
  206. de:=z*f + h*y*g$
  207. lisp(proc_list_ := '(subst_level_4 separation))$
  208. crack({de},{},{f,g},{z});
  209. {{{},{g=0,f=0},{},{}}}
  210. nodepnd {f,g,h}$
  211. write"-------------------------------------------------------"$
  212. -------------------------------------------------------
  213. write" Separation: Indirect separation of PDEs"$
  214. Separation: Indirect separation of PDEs
  215. write" (combined with integration)"$
  216. (combined with integration)
  217. comment
  218. This example is the same as before, only now h is not assumed
  219. to be given but to be calculated. In this example there is no
  220. variable turning up only explicitly to allow a direct separation.
  221. But there is also no function which depends on all variables
  222. and this allows the use of an indirect separation method. This
  223. example also demonstrates factorization and the splitting
  224. into subcases to do substitutions in non-linear problems.
  225. Three solutions result,
  226. 1. f=h=0, g arbitrary,
  227. 2. f,g,h given in terms of two constants, both non-vanishing
  228. 3. f=g=0, h arbitrary, h non-vanishing. $
  229. depend f,y$
  230. depend g,x$
  231. depend h,z$
  232. de:=z*f + h*y*g$
  233. lisp(proc_list_ := '(subst_level_3 separation
  234. gen_separation alg_solve_single))$
  235. crack({de},{},{f,g,h},{});
  236. {{{},{g=0,f=0},{h},{}},
  237. {{},
  238. - c_13
  239. {h= - c_14*z,g=---------,f= - c_13*y},
  240. c_14
  241. {c_13,c_14},
  242. {c_14,c_13}},
  243. {{},{h=0,f=0},{g},{g}}}
  244. nodepnd {f,g,h}$
  245. write"======================================================="$
  246. =======================================================
  247. write" Combination: Pseudo Differential Groebner Basis"$
  248. Combination: Pseudo Differential Groebner Basis
  249. comment
  250. Another group of modules tries to take advantage of
  251. combining equations or their derivatives. The main tool
  252. in this respect computes a Pseudo Differential Groebner
  253. Basis. In interactive mode (off batch_mode) it is possible
  254. to choose between different orderings of derivatives which
  255. is not demonstrated here. (The origin of the following
  256. example is described at the end of this file.) ;
  257. depend xi ,x,y$
  258. depend eta,x,y$
  259. lisp(proc_list_ := '(separation decoupling))$
  260. crack({2*df(eta,x,y)*x**5*y1
  261. + df(eta,x,2)*x**5 - df(eta,x)*x**4
  262. - 2*df(eta,x)*x**2*y + df(eta,y,2)*x**5*y1**2
  263. - 4*df(eta,y)*x*y**2 - 2*df(xi,x,y)*x**5*y1**2
  264. - df(xi,x,2)*x**5*y1 - df(xi,x)*x**4*y1
  265. - 2*df(xi,x)*x**2*y*y1
  266. + 8*df(xi,x)*x*y**2 - df(xi,y,2)*x**5*y1**3
  267. - 2*df(xi,y)*x**4*y1**2 - 4*df(xi,y)*x**2*y*y1**2
  268. + 12*df(xi,y)*x*y**2*y1 - 2*eta*x**2*y1 + 8*eta*x*y
  269. + x**3*xi*y1 + 6*x*xi*y*y1 - 16*xi*y**2},
  270. {},{eta,xi},{x,y,y1});
  271. {{{xi ,
  272. y
  273. 2
  274. xi *x - xi *x + xi,
  275. 2x x
  276. 3 2
  277. xi *x - xi *x*y - eta*x - x *xi + 3*xi*y},
  278. x x
  279. {},
  280. {xi,eta},
  281. {}}}
  282. nodepnd {xi,eta}$
  283. write"-------------------------------------------------------"$
  284. -------------------------------------------------------
  285. write" Combination: Shortening linear PDE systems"$
  286. Combination: Shortening linear PDE systems
  287. comment
  288. To reduce memory requirements now and for further
  289. computations with a system of equations it is advisable
  290. to find length reducing linear combinations. The shorther
  291. equations become, the more useful they are to shorten
  292. other equations and the more likely they are integrable.;
  293. depend f,x,y$
  294. a:=sin(x)*y+7*x+3*df(f,x)$
  295. b:=df(f,y)*y+f*x+x*y**2$
  296. c:=3*x*y**2+sin(x)*y-4$
  297. lisp(proc_list_ := '(alg_length_reduction))$
  298. crack({a,a*c+b},{},{f},{});
  299. {{{3*f + sin(x)*y + 7*x,
  300. x
  301. 2
  302. f *y + f*x + x*y },
  303. y
  304. {},
  305. {f},
  306. {}}}
  307. clear a,b,c$
  308. nodepnd {f}$
  309. write"======================================================="$
  310. =======================================================
  311. write" Parametric solution of linear underdetermined ODEs"$
  312. Parametric solution of linear underdetermined ODEs
  313. comment
  314. The following example demonstrates an algorithm for the
  315. parametric solution of underdetermined linear ODEs with
  316. arbitrary non-constant cefficients. $
  317. depend f,x$
  318. depend g,x$
  319. lisp(proc_list_ := '(subst_level_4 undetlinode))$
  320. crack({cos(x)*df(f,x,2) - df(g,x,2)},{},{f,g},{});
  321. {{{},
  322. 5 4 4
  323. {g=(6*cos(x) *c_17 - cos(x) *c_17 *sin(x) + 9*cos(x) *sin(x)*c_17
  324. x 2x
  325. 3 2 2
  326. + 2*cos(x) *c_17 - 2*cos(x) *c_17 *sin(x) + 2*cos(x) *sin(x)*c_17
  327. x 2x
  328. 6 4
  329. - 8*cos(x)*c_17 - 8*sin(x)*c_17)/(cos(x) *sin(x) + 4*cos(x) *sin(x)
  330. x
  331. 2
  332. + 4*cos(x) *sin(x)),
  333. 4 4 3
  334. f=( - cos(x) *c_17 + 4*cos(x) *c_17 - 4*cos(x) *c_17 *sin(x)
  335. 2x x
  336. 2 2
  337. - 2*cos(x) *c_17 - 6*cos(x) *c_17 - 4*cos(x)*c_17 *sin(x) - 4*c_17)/(
  338. 2x x
  339. 7 5 3
  340. cos(x) + 4*cos(x) + 4*cos(x) )},
  341. {c_17},
  342. {}}}
  343. nodepnd {f,g}$
  344. write"======================================================="$
  345. =======================================================
  346. write"Application: Investigating point symmetries of an ODE"$
  347. Application: Investigating point symmetries of an ODE
  348. comment
  349. Finally a small real life example that demonstrates
  350. the interplay of different modules to solve completely
  351. an overdetermined system which is generated when
  352. investigating the point symmetries of the ODE 6.97
  353. in Kamke's book using the following CRACK input: $
  354. % depend y,x$
  355. % load_package crack,liepde$
  356. % liepde({{df(y,x,2)*x**4-df(y,x)*(2*x*y+x**3)+4*y**2},{y},{x}},
  357. % {"point"},{})$
  358. comment
  359. (and renaming xi_x --> xi, eta_y --> eta, y!`1 --> y1
  360. which is only done to ease reading). Instead of just
  361. doing this liepde-call which would take care of
  362. everything, we call crack below explicitly for
  363. demonstration. Two arbitrary constants in the solution
  364. stand for two symmetries. $
  365. depend xi ,x,y$
  366. depend eta,x,y$
  367. lisp(proc_list_ := initial_proc_list_)$
  368. % this was saved at the start
  369. crack({2*df(eta,x,y)*x**5*y1
  370. + df(eta,x,2)*x**5 - df(eta,x)*x**4
  371. - 2*df(eta,x)*x**2*y + df(eta,y,2)*x**5*y1**2
  372. - 4*df(eta,y)*x*y**2 - 2*df(xi,x,y)*x**5*y1**2
  373. - df(xi,x,2)*x**5*y1 - df(xi,x)*x**4*y1
  374. - 2*df(xi,x)*x**2*y*y1
  375. + 8*df(xi,x)*x*y**2 - df(xi,y,2)*x**5*y1**3
  376. - 2*df(xi,y)*x**4*y1**2 - 4*df(xi,y)*x**2*y*y1**2
  377. + 12*df(xi,y)*x*y**2*y1 - 2*eta*x**2*y1 + 8*eta*x*y
  378. + x**3*xi*y1 + 6*x*xi*y*y1 - 16*xi*y**2},
  379. {},{xi,eta},{x,y,y1});
  380. {{{},
  381. 2
  382. {eta= - 2*log(x)*c_22*y - c_22*x + c_22*y - 2*c_23*y,
  383. xi= - log(x)*c_22*x - c_23*x},
  384. {c_23,c_22},
  385. {}}}
  386. nodepnd {xi,eta}$
  387. write"======================================================="$
  388. =======================================================
  389. write" Integration: Solving a linear 1st order PDE"$
  390. Integration: Solving a linear 1st order PDE
  391. comment
  392. If the computation of a differential Groebner Basis is getting
  393. bigger and bigger and normal integration is not successful and
  394. also no functions of fewer variables are present then trying
  395. the solution of a 1st order linear PDE is recommended. $
  396. lisp(proc_list_ := '(subst_level_4 full_integration
  397. gen_separation find_trafo))$
  398. depend f,x,y;
  399. crack({df(f,x)-x**2*y*df(f,y)+x},{},{f},{});
  400. 2
  401. - 2*c_24 - x%
  402. {{{},{f=-----------------},{c_24},{}}}
  403. 2
  404. write "The list of transformations done (here only one): ",
  405. lisp done_trafo;
  406. 3
  407. x /3
  408. The list of transformations done (here only one): {{x%=x,y%=e *y}}
  409. nodepnd {f}$
  410. write"======================================================="$
  411. =======================================================
  412. lisp(depl!*:=nil)$
  413. % to delete all dependencies of functions on variables
  414. end$
  415. Time for test: 2080 ms, plus GC time: 70 ms