-
Notifications
You must be signed in to change notification settings - Fork 1
/
esymmxp
310 lines (185 loc) · 6.2 KB
/
esymmxp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
#:mode=maple:
#
#
# parmElimXP take a list eql of lpdgl in the fs and fselim.
# It eliminates the fselim from the eql by a lexorder Janet-Base computation,
# where all the fs precede all the fselim
# all functions are extended to virtually depend on the union of the arguments
# of the fs and fselim. Missing dependencies are expressed as differential conditions
# diff(f(args),var)
# cnselim contains constants to be eliminated
#
#
#
parmElimXP := proc ( eql, fs, fselim, cnselim )
local i, varsretain, varselim,
allvars, allvarsl,
fsext, fselimext, cnselimext,
slext, slelimext, slcnselimext,
allsubsl,
auxeq,
ff, v,
maineqs,
fsa, jb;
varsall := {};
if nargs = 5 then
varsall := {op(args[5])};
fi;
varsretain := `union` ( seq ( {op( dgetvars ( [fs[i]] ))}, i=1..nops(fs)) );
varselim := `union` ( seq ( {op( dgetvars ( [fselim[i]] ))}, i=1..nops(fselim)) );
allvars := `union` ( varsretain, varselim, varsall );
allvarsl := [op(allvars)];
fsext := map ( (xx,yy)->cat(op(0,xx),EXTQQQ)(op(yy)), fs, allvarsl );
fselimext := map ( (xx,yy)->cat(op(0,xx),EXTQQQ)(op(yy)), fselim, allvarsl );
cnselimext := map ( (xx,yy)->cat(xx,EXTQQQ)(op(yy)), cnselim, allvarsl );
slext := zip ( (xx,yy)->xx=yy, fs, fsext);
slelimext := zip ( (xx,yy)->xx=yy, fselim, fselimext );
slcnselimext := zip ( (xx,yy)->xx=yy, cnselim, cnselimext );
allsubsl := [op(slext), op(slelimext), op(slcnselimext)];
auxeq := [];
for ff in [op(fs), op(fselim),op(cnselim)] do
for v in allvarsl do
if diff (ff, v ) = 0 then
auxeq := [op(auxeq), diff(subs(allsubsl, ff),v)];
# not particularly efficient, but short to write...
fi;
od;
od;
maineqs := subs ( allsubsl, eql );
fsa := [op(fsext), op(fselimext), op(cnselimext)];
# fsa is fsall, fsext has the functions that we want to retain after
# lexorder janetbase computation where the fs have lowest order
#setcotes ( fsa, lexOrder(fsa));
setcotes ( fsa, elimOrder2(fsa, nops(fselimext)+nops(cnselimext)) );
# there the lexOrder is introduced.
jb := makeJanetBase ( [op(maineqs), op(auxeq)], fsa );
jb := csimpJanetBase ( jb, fsa );
jb := dselfun ( jb, fsa, fsext );
# dselfun does the trick of retaining 'pure fsext' functions
remcotes ( fsa );
# now we substitute back fsext to fs:
jb := subs ( swapeqs ( slext ), jb );
jb := simplify ( jb );
jb := select ( x->x<>0, jb );
end;
#
#
# computes the determining system of a system of dgl fnu(x^i,u^j_J) = 0
# this algorithm does *not* depend on substituion of relations f(x^i,u^j_J) = 0
# but works by eliminating 'dummy functions' qnu(x^i,u^j) in expressions
# X(ext) appl fmu (x^i,u^j_J ) + sum qnu(x^i,u^j) * fnu (x^i,u^j_J ) = 0
#
# X(ext) appl fmu (x^i,u^j_J ) means: apply the extension of X=xi^i*d_(x^i)+eta^j*d_(u^j)
# in an appropriate prolongation (to comprise all the fnu) to the function fmu
#
#
#
makeDeterminingSystemXP := proc ( deqs, varLists, fns )
local i,
odeflag,
m, n,
deqs1,
ndeqs,
vBLists, varLists1,
zeroI,
vBLists1,
vfini,
deqslist,
dvarslist, dvars, dvars0,
reslist,
vectfini,
deqsorder,
allvars,
dummyfns,
variat,
vectfi,
resi,
erg;
global _solvevars;
if has ( [args], odetype ) then
odeflag := true;
else
odeflag := false;
fi;
m := nops ( varLists[1] );
n := nops ( varLists[2] );
deqs1 := deqs;
if type ( deqs1, algebraic ) then
deqs1 := [ deqs1 ];
fi; # for convenience of input
ndeqs := nops ( deqs1 );
#
# put the differential equation into jet-form with respect to the variables in varLists
#
deqs1 := map ( deqtoextform, deqs1, varLists );
#
# the result is a set of pairs of list, each pair has first the deq in jet-form,
# second a set of elements describing the dependend variables in jet-space
# appearing in this deq in the form [varindex,[deg1,...,degn]], e.g. [1,[2]] for
# y[2] when varLists is [[x],[y]]
#
vBLists := [[seq ( TTT.i, i = 1..m )],
[seq ( XXX.i, i = 1..n )] ];
varLists1 := fntoatom ( varLists );
zeroI := [ 0 $ m ];
vBLists1 := [ vBLists[1], [seq ( makeextstr ( i, vBLists, zeroI ), i=1..n )]];
#
# vfini is the vector descibing the displacement of the independent variables and
# the dependent variables of zeroth degree
#
vfini := convert ( zip ( (x,y)->x*y, flatten2(vBLists), fns ), `+` );
#
# this call of dprolong initializes the `prolongation engine` for later calls
# to `computeEtaVal`
#
dprolong ( vfini, vBLists, varLists1, 1, noforget );
deqslist := map ( x->x[1], deqs1 );
#
# follows the computation of the variables appearing in the jet-form of the deqs in
# deqslist
#
dvarslist := map ( x->x[2], deqs1 );
dvars := `union` ( op ( dvarslist ) );
dvars0 := select ( x->tdegfun(x[2]) > 0, dvars );
dvars0 := map ( (x,y)-> makeextstr ( x[1], y, x[2] ), dvars0, varLists1 );
#
# dvars0 contains the dependend variables which appear in the
# jet-form of the deqs in deqslist excluding those of the form y[0,0,...,0]
#
# dvars contains these too
#
dvars := map ( (x,y)-> makeextstr ( x[1], y, x[2] ), dvars, varLists1 );
reslist := [];
#
# attention : vectfini is redefined to contain only displacement with respect to the
# independent variables
#
#
vectfini := convert ( zip ( (x,y)->x*y, vBLists[1], [op(fns[1..m])] ), `+` );
deqsorder := vecorder ( deqslist, varLists1 );
allvars := makeextvarlist ( varLists1, deqsorder );
lowvars := makeextvarlist ( varLists1, 0 );
dummyfns := [seq ( QQQDUMMY ( op(lowvars) ) , i = 1..nops(deqslist) )];
variat := add ( dummyfns[i] * deqslist[i], i=1..nops(deqslist) );
for i from 1 to nops ( deqslist ) do
# now a vector decribing the infinitesimal movement is constructed with
# respect to only those variables that actually appear in the
# deq just considered
vectfi := convert (
map ( (x,y)->makeextstr ( x[1], y, x[2] ) *
computeEtaVal (x[1],x[2]), dvarslist[i], vBLists ),
`+` );
#
# now it is applied ( vectfini is added for displacement of the independent
# variables )
#
resi := vecapply ( vectfini+vectfi, vBLists, varLists1, deqslist[i] );
resi := resi + variat;
reslist := [op(reslist), resi ];
od;
forget ( makeDoperat );
forget ( computeEtaVal );
fns1:= vectostdform ( fns, vBLists, varLists1 );
erg := parmElimXP ( reslist, fns1, dummyfns, [], allvars );
erg := vectoshortform ( erg, vBLists, varLists1 );
end;