1 /* -*- Mode: MACSYMA; Package: CL-MAXIMA -*- */
3 desolve(eqns,vars):=block([teqns,tvars,ovar,lvar,flag,dispflag],
4 modedeclare(flag,boolean),
6 if not listp(vars) then (eqns:[eqns], vars:[vars], flag:true),
7 if length(ovar:vars[1])#1 then
8 error(ovar,"contains more than one independent variable."),
9 ovar:inpart(ovar,1),dispflag:false,
10 teqns:map(lambda([z],laplace(z,ovar,lvar)),eqns),
11 tvars:map(lambda([z],'laplace(z,ovar,lvar)),vars),
12 /* if not freeof(nounify('diff),teqns) then return(false), */
13 teqns:errcatch(solve(teqns,tvars)),
14 if teqns=[] or teqns=[[]]
15 then error("desolve can't handle this case.")
16 else teqns:first(teqns),
17 if flag#true then teqns:first(teqns),
18 teqns:map(lambda([z],ilt(z,lvar,ovar)),teqns),
19 if flag and length(tvars)=1 then teqns[1] else teqns)$