How to create MAX integrate rule?



The commercial macsyma gives

  - ((a^2 - 2 * a * t)/2)


What did you want to get?


What part doesn't work in maxima?




Wolfgang Jenkner wrote:
> Alexander <vidybida@bitp.kiev.ua> writes:
> 
> 
>>how to prepare a rule to integrate functions with MAX(.,.)?
> 
> 
> Please try the following code, e.g, with demo("integrate_abs.dem");
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /* integrate_abs.dem */
> 
> print("Quick and dirty...")$
> 
> matchdeclare([%a%,%b%],true);
> defrule(maxabs,max(%a%,%b%),(abs(%b%-%a%)+%b%+%a%)/2);
> 
> /* For simplicity, I assume here that ARG does not contain
> indefinite integrals. */
> split_integrals_at_0(arg):=
> subst(
>   lambda([exp,x,a,b],
>     integrate(exp,x,0,b)-integrate(exp,x,0,a)),
>   nounify(integrate),arg);
> 
> declare(integrate,linear);
> 
> assume(t>0);
> assume(a>t);
> 
> integrate(max(t-x,0),x,0,a);
> int:changevar(%,t-x=y,y,x);
> apply1(%,maxabs);
> split_integrals_at_0(%);
> 
> forget(a>t);
> assume(a<t);
> 
> int;
> apply1(%,maxabs);
> split_integrals_at_0(%);
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Wolfgang
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima