# [Maxima] Integration of (a-b)^n

Viktor T. Toth vttoth at vttoth.com
Tue Sep 21 11:00:16 CDT 2010

```I think the following might offer a partial answer to your question:

(%i1) integrate((a-b)^2,a)-expand((a-b)^3/3);
3
b
(%o1)                                 --
3

The difference between the answer you were hoping to get and the answer
Maxima provides is a constant term (constant with respect to the integration
variable a). The indefinite integral is indeterminate up to a constant term,

Viktor

-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Ian Bell
Sent: Sunday, September 19, 2010 12:51 PM
To: maxima at math.utexas.edu
Subject: [Maxima] Integration of (a-b)^n

Hello all,

I'm a relatively new Maxima user, though I have found the software to be
user friendly enough, and you can't beat the price.

My question relates to definite integration, a tricky subject, and one which
a lot of CAS programs struggle with.  So what I want to know is how I get
integrate((a-b)^2,a) to give me the factored solution (a-b)^3/3 . Maxima
(and Mathematica for that matter), expand the product and then group all the
constants together since mathematically they all drop out when you plug in
limits.  In this way it makes it impossible to refactor the anti-derivative
back to the form (a-b)^3 .   I've got a lot of other integrals that I have a
similar problem with, like (a-b)^n*sin(a) with n an integer.  For what its
worth, in MATLAB (w/ MuPaD) int((a-b)^2,a) yields (a-b)^3/3
Any thoughts would be greatly appreciated.

Kind Regards,
Ian

----
Ian Bell