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