Question: solve vs. PDEtools:-Solve for piecewise equation.

Maple 2026

I had 3 equations wrapped in piecewise.  When asking solve to solve for a constant in each equation the output was formated completely different from what Solve gave. I prefer the Solve output.

Which do you think the better output?  

Another strange thing I found on this, is that when I asked Sovle to use solve as solver (using the option solver=solve), now Solve returned no solution!  Do not know why.

Here is the code

constants_of_integrations:={_C1};
eq:=piecewise(a < 0,exp(-a)*_C1=0,a < 1,exp(-a)*_C1+2-2*exp(-a)=0,1 <= a,exp(-a)*_C1+2*exp(-a+1)-2*exp(-a) = 0);
sol:=solve(eq,constants_of_integrations);

 

constants_of_integrations := {c__1}

eq := piecewise(a < 0, exp(-a)*c__1 = 0, a < 1, exp(-a)*c__1+2-2*exp(-a) = 0, 1 <= a, exp(-a)*c__1+2*exp(-a+1)-2*exp(-a) = 0)

piecewise(a < 0, [{c__1 = 0}], a < 1, [{c__1 = -2*exp(a)+2}], 1 <= a, [{c__1 = -2*exp(1)+2}])

sol:=PDEtools:-Solve(eq,constants_of_integrations);
 

sol := {c__1 = piecewise(a < 0, 0, a < 1, -2*exp(a)+2, 1 <= a, -2*exp(1)+2)}

sol:=PDEtools:-Solve(eq,constants_of_integrations,'solver'=solve); #why this below?

 

 

Download different_output_from_solve_and_Solve.mw

You see from the output above, Solve output is the more logical one.  Do you agree?

So for now, I check if equations has piecewise and switch to using Solve as I could not find how to make solve give same output as Solve.

Please Wait...