[Aimmath-commit] AIM/WEB-INF/maple/aim Inert.mpl,1.12,1.13
Brought to you by:
gustav_delius,
npstrick
From: <mo...@us...> - 2004-02-16 03:24:47
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28554 Modified Files: Inert.mpl Log Message: Improvements to Inertify() Index: Inert.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Inert.mpl,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Inert.mpl 14 Feb 2004 17:55:08 -0000 1.12 --- Inert.mpl 16 Feb 2004 03:17:02 -0000 1.13 *************** *** 389,428 **** `Package/Assign`( `Inertify`::procedure, ! "Tries its best to convert a Maple expression to an InertExpr. This is meant to be somewhat of an inverse operation to Value (though Value is clearly not 1-1).", proc(f::anything) ! local num,den,i; if type(f, `+`) then ! HardPlus(op(map(Inertify,[op(f)]))) elif type(f,`*`) then num:=NULL; den:=NULL; for i in [op(f)] do if type(i,`^`(anything,negint)) then ! den:=eval(den),Inertify(op(1,i)^(-op(2,i))); elif type(i,fraction) then if not type(op(1,i),identical(1)) then ! num:=eval(num),Inertify(op(1,i)); fi: ! den:=eval(den),Inertify(op(2,i)); else ! num:=eval(num),Inertify(i); fi: od: if den=NULL then ! Cdot(num) else if num=NULL then num:=1 fi; ! Over(Cdot(num),Cdot(den)) fi # Cdot(op(map(Inertify,[op(f)]))) elif type(f,`^`) then if type(op(2,f),negint) then ! Over(1,ToThe(Inertify(op(1,f)),-op(2,f))) else ! ToThe(op(map(Inertify,[op(f)]))) fi; elif type(f,exp(anything)) then ! Exp(op(map(Inertify,[op(f)]))) elif type(f,ln(anything)) then ! Ln(op(map(Inertify,[op(f)]))) elif type(f,float) then Decimal(f) --- 389,430 ---- `Package/Assign`( `Inertify`::procedure, ! "Tries its best to convert a Maple expression to an InertExpr. This is meant to be somewhat of an inverse operation to Value (though Value is clearly not 1-1). If called with the second optional argument @'soft'@, it will convert @+@ and @*@ to @Plus@ and @Times@ instead of @HardPlus@ and @Cdot@", proc(f::anything) ! local num,den,i,plusmap,timesmap,m; ! plusmap:=[HardPlus,Plus]; timesmap:=[Cdot,Times]; ! m:=`if`(nargs=1,1,2); if type(f, `+`) then ! plusmap[m](op(map(Inertify,[op(f)],args[2..-1]))) elif type(f,`*`) then num:=NULL; den:=NULL; for i in [op(f)] do if type(i,`^`(anything,negint)) then ! den:=eval(den),Inertify(op(1,i)^(-op(2,i)),args[2..-1]); elif type(i,fraction) then if not type(op(1,i),identical(1)) then ! num:=eval(num),Inertify(op(1,i),args[2..-1]); fi: ! den:=eval(den),Inertify(op(2,i),args[2..-1]); else ! num:=eval(num),Inertify(i,args[2..-1]); fi: od: if den=NULL then ! timesmap[m](num) else if num=NULL then num:=1 fi; ! Over(timesmap[m](num),timesmap[m](den)) fi # Cdot(op(map(Inertify,[op(f)]))) elif type(f,`^`) then if type(op(2,f),negint) then ! Over(1,ToThe(Inertify(op(1,f),args[2..-1]),-op(2,f))) else ! ToThe(op(map(Inertify,[op(f)],args[2..-1]))) fi; elif type(f,exp(anything)) then ! Exp(op(map(Inertify,[op(f)],args[2..-1]))) elif type(f,ln(anything)) then ! Ln(op(map(Inertify,[op(f)],args[2..-1]))) elif type(f,float) then Decimal(f) |