# $Source: /u/maple/research/lib/DEtools/src/RCS/rightdivision,v $ # $Notify: mvanhoei@daisy.uwaterloo.ca $ # The purpose of this file is to do the type checking and conversions # for the file DEtools/diffop/rightdivision, for the procedures: # rightdivision, leftdivision, GCRD, LCLM, adjoint, mult macro( x=`DEtools/diffop/x`, DF=`DEtools/diffop/DF`, to_diffop=`DEtools/diffop/to_diffop`, to_eqn=`DEtools/diffop/to_eqn`, rightdivision=`DEtools/diffop/rightdivision`, leftdivision=`DEtools/diffop/leftdivision`, GCRD=`DEtools/diffop/GCRD`, LCLM=`DEtools/diffop/LCLM`, adjoint=`DEtools/diffop/adjoint`, mult=`DEtools/diffop/mult` ): # The syntax L,domain is allowed as well. # Output: the adjoint equation/operator. `DEtools/adjoint`:=proc(eqn,dvar) local L; # The traperror is to make sure that the user gets the # error message from this procedure rather than from some # long weird name. option `Copyright (c) 1997 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; L:=traperror(to_diffop(args)); if L=lasterror then error L fi; to_eqn(adjoint(L),args[2..nargs]) end: #savelib('`DEtools/adjoint`'): # Both for operator and equation syntax. `DEtools/rightdivision`:=proc(f,g,domain) local v; option `Copyright (c) 1997 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; v:=traperror([to_diffop(f,args[3..nargs]),to_diffop(g,args[3..nargs])]); if v=lasterror then error v fi; to_eqn(rightdivision(op(v)),args[3..nargs]) end: #savelib('`DEtools/rightdivision`'): # Both for operator and equation syntax. `DEtools/leftdivision`:=proc(f,g,domain) local v; option `Copyright (c) 1997 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; v:=traperror([to_diffop(f,args[3..nargs]),to_diffop(g,args[3..nargs])]); if v=lasterror then error v fi; to_eqn(leftdivision(op(v)),args[3..nargs]) end: #savelib('`DEtools/leftdivision`'): # Input syntax: only differential operators. The reason for that # is that I don't know the number of arguments, which makes it # awkward to distinguish the difference between an operator and # an equation. `DEtools/mult`:=proc() global x,DF; local d,a; # I'm not quite sure if these readlibs necessary, but # just in case: option `Copyright (c) 1997 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; if nargs=0 then return 1 elif type(args[nargs],list) then d:=args[nargs]; a:=args[1..nargs-1] else a:=args; d:=_Envdiffopdomain; if not type(d,list) then error "differential algebra not specified" fi fi; `DEtools/diffop/l_p`(); # call the code in DEtools/diffop sort(subs(DF=d[1],x=d[2], mult(op(subs(d[1]=DF,d[2]=x,[a])))),d[1]) end: #savelib('`DEtools/mult`'): # Input syntax: only differential operators. `DEtools/GCRD`:=proc() global x,DF; local d,a; # I'm not quite sure if these readlibs necessary, but # just in case: option `Copyright (c) 1997 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; if type(args[nargs],list) then d:=args[nargs]; _Envdiffopdomain:=d; # for the userinfo's in diffop. a:=args[1..nargs-1] else a:=args; d:=_Envdiffopdomain; if not type(d,list) then error "differential algebra not specified" fi fi; `DEtools/diffop/l_p`(); # call the code in DEtools/diffop sort(subs(DF=d[1],x=d[2], GCRD(op(subs(d[1]=DF,d[2]=x,[a])))),d[1]) end: #savelib('`DEtools/GCRD`'): # Input syntax: only differential operators. `DEtools/LCLM`:=proc() global x,DF; local d,a,i,s; option `Copyright (c) 1997 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; a:=[args]; i:=indets(a,{'radical','nonreal'}); if i<>{} then i:=radfield(i); return subs(i[2],procname(op(eval(subs(i[1],a))))) fi; s:=NULL; for i from 1 to nops(a) do if type(a[i],equation) and lhs(a[i])='groundfield' then s:=`and conjugates`,rhs(a[i]); a:=subsop(i=NULL,a); break fi od; if type(a[-1],list) then d:=a[-1]; _Envdiffopdomain:=d; # for the userinfo's in diffop. a:=a[1..-2] else d:=_Envdiffopdomain; if not type(d,list) then error "differential algebra not specified" fi fi; `DEtools/diffop/l_p`(); # call the code in DEtools/diffop sort(subs(DF=d[1],x=d[2], LCLM(op(subs(d[1]=DF,d[2]=x,[op(a),s])))),d[1]) end: #savelib('`DEtools/LCLM`'):