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