Hi Robert,
Thanks for that.
Robert Dodier wrote:
> Hi Glenn,
>>How do I define a piecewise function that can be manipulated by maxima?
> 'if --- quote mark tells Maxima to make an unevaluated conditional.
> matchdeclare & tellsimpafter --- these set up pattern-matching rules.
>
> (%i2) matchdeclare ([aa, bb, cc, xx], true);
> (%o2) done
> (%i3) tellsimpafter ('diff ('if aa then bb else cc, xx), 'if aa then
> diff (bb, xx) else diff (cc, xx));
> (%o3) [derivativerule1,?simpderiv]
>
> OK, now we have a rule for the derivative of an
> unevaluated conditional. (Note that the placement
> of quote marks is important.) Let's try it:
>
> (%i4) diff ('if u > 0 then f(u) else g(u), u);
> (%o4) if u > 0 then 'diff(f(u),u,1) else 'diff(g(u),u,1)
> Unevaluated conditionals is one of my pet topics.
> I am working on some code to expand Maxima's
> handling of them. However it's not part of Maxima yet.
Next problem. How do I plot the piecewise function?
(%i6) tn(x):=block([u],u:0.04625278034765223, if(x 07 8627077
http://www.componic.co.nz