You might try using
sin(x)*( 'if (x>1) then 1 else 2);
(that is, quote the if),
Changing the setting of prederror might help, but I suspect not.
RJF
Michael Krasnyk wrote:
> Hi,
>
> I'm trying to use Maxima for differentiation, but
> don't know how to differentiate conditional expressions.
> For example, in Mathematica I have such result:
> In[1]:=D[Sin[x]*(If [x > 1, x, -x^2]), x]
> Out[1]=Cos[x] If[x > 1, x, -x^2)] + If[x > 1, 1, -2 x] Sin[x]
>
> and the same in Maxima fails with an error.
> (%i1) diff(sin(x)*(if (x>1) then x else -x^2),x);
> MACSYMA was unable to evaluate the predicate:
> x > 1
> -- an error. Quitting. To debug this try DEBUGMODE(TRUE);
>
> Is there any way to differentiate such expressions in Maxima?
>
> Thanks in advance,
> Michael
>
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima