# [Maxima] tellsimp problem

Richard Hennessy rvh2007 at comcast.net
Sun Oct 26 11:32:17 CDT 2008

```Barton,

I have worked out these rules for integrating simple or complicated functions multiplied by the unit_step(x-a).  They

matchdeclare([aa,bb],constantp,xx,symbolp)\$
matchdeclare(uu, freeof('unit_step))\$

simp:false\$

tellsimp('integrate(uu*unit_step(xx+aa),xx),(at(integrate(at(uu,[xx=xx-aa]),xx),[xx=xx+aa])-at(integrate(at(uu,[xx=xx-aa]),xx),[xx=0]))*unit_step(xx+aa))\$
tellsimp('integrate(uu*unit_step(xx),xx),(integrate(uu,xx)-at(integrate(uu,xx),[xx=0]))*unit_step(xx))\$

tellsimp('integrate(unit_step(xx+aa),xx),(xx+aa)*unit_step(xx+aa))\$
tellsimp('integrate(unit_step(xx),xx),xx*unit_step(xx))\$

simp:true\$

For some reason these rules work even though I declared xx as symbolp.  I was going to add support for

complicatedexpr1*unit_step(a*x+b)

but that does not work for some reason so I am going to drop supporting that and just limit my cases to

complicatedexpr1*unit_step(x+b).

I didn't plan to integrate unit_step(x^2-x+exp(-x^2-1/2)) or anything like that but now I want that to work too if there
is a way.  But that can wait until I figure out how.  I just need the simple case for most applications.

It would be pretty cool to be able to do this too.

complicatedexpr1*unit_step(complicatedexpr2)

But I am not close yet to being able to do that.

Rich

----- Original Message -----
From: "Barton Willis" <willisb at unk.edu>
To: "Richard Hennessy" <rvh2007 at comcast.net>
Cc: "Maxima List" <maxima at math.utexas.edu>
Sent: Saturday, October 25, 2008 9:02 PM
Subject: Re: [Maxima] tellsimp problem

to find antiderivatives of functions that involve the unit_step,
here is one approach:

(%i15) put(abs, [lambda([u], u), true], 'darboux_poly)\$
(%i17) myintegrate(f,x) := pmint(subst('unit_step = lambda([s], (s + abs
(s))/(2*s)), f),x)\$

(%i27) myintegrate(unit_step(x),x);
(%o27) (x^3*abs(x)+x^4)/(2*x^2*abs(x))

(%i31) myintegrate(unit_step(x^2-1),x);
(%o31) (x^5*abs(x^2-1)-2*x^3*abs(x^2-1)+x*abs
(x^2-1)+x^3*(x^2-1)^2-x*(x^2-1)^2)/(2*(x^2-1)^2*abs(x^2-1))

(%i32) myintegrate(exp(x) * unit_step(x-1),x);
(%o32) (x^2*%e^x*abs(x-1)-2*x*%e^x*abs(x-1)+%e^x*abs(x-1)+
(x-1)^2*x*%e^x-(x-1)^2*%e^x)/(2*(x-1)^2*abs(x-1))

The message

http://www.math.utexas.edu/pipermail/maxima/2008/012535.html

has a link to a location of pmint.mac.

Barton

```