Serious bug in ic2



Robert Marik <marik <at> mendelu.cz> writes:

> 
> Hello all, 
> 
> I found perhaps serious bug in ic2:
> 
> A:ode2('diff(y,x,2)+y*('diff(y,x)^3)=0,y,x);
> ic2(A,x=0,y=1,'diff(y,x)=2);
> 
> 
> ic2(soln,xa,ya,dya):=
>       block([programmode:true,backsubst:true,singsolve:true,temp,%k2,%k1],
>          noteqn(xa), noteqn(ya), noteqn(dya),
>          boundtest('%k1,%k1), boundtest('%k2,%k2),
>          temp: lhs(soln) - rhs(soln),
>          temp: maplist(lambda([zz], subst(zz,soln)),
>    		    solve([subst([xa,ya],soln), subst([dya,xa],
>    			     lhs(dya)=-subst(0,lhs(dya),diff(temp,lhs(xa)))
>    				       /diff(temp,lhs(ya)))],
>    			  [%k1,%k2])),
>          if length(temp)=1 then return(first(temp)) else return(temp))$

And this could be the fix 

ic2(soln,xa,ya,dya):=
       block([programmode:true,backsubst:true,singsolve:true,temp,%k2,%k1], 
          noteqn(xa), noteqn(ya), noteqn(dya), 
          boundtest('%k1,%k1), boundtest('%k2,%k2), 
          temp: lhs(soln) - rhs(soln), 
          TEMP_k:solve([subst([xa,ya],soln), subst([dya,xa],
            lhs(dya)=-subst(0,lhs(dya),
            diff(temp,lhs(xa)))/diff(temp,lhs(ya)))],[%k1,%k2]), 
          if not freeof(lhs(ya),TEMP_k) or not freeof(lhs(xa),TEMP_k) 
              then return (false), 
          temp: maplist(lambda([zz], subst(zz,soln)), TEMP_k), 
          if length(temp)=1 then return(first(temp)) else return(temp))

perhaps in a similar way could be fixed bc2

Yours sincerelly
Robert Marik