# [Maxima] problems

Rupert Swarbrick rswarbrick at gmail.com
Mon Jan 2 07:28:57 CST 2012

```leon.magiera at wp.pl writes:
> Problem 2
>
>            ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1));
>
>            integrate(ex,x);
>
> Is the above integral too hard ?

For this, have a look at what your expression is. Firstly, the
x-b looks unpleasant so lets ignore that. Note that

integrate (f(x - b), x, u, v) = integrate (f(x), x, u-b, v-b)

and indeed you're asking for the indefinite integral, so this comes out
as something like

(integrate (f(x - b), x) at x=v) = (integrate (f(x), x) at x=v-b)

Anyway, that lets us get rid of the "-b" for a bit:

(%i1) ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1))\$

(%i2) no_b: subst(x, x-b, ex);
1
(%o2)                     --------------------------
2
2    2       x
sqrt(x  + a ) sqrt(-- + 1)
2
a

Hmm. Now it looks like there should be some cancelling going on here. I
admit I did this on paper, but Maxima can do it too:

(%i3) %, ratsimp;
abs(a)
(%o3)                               -------
2    2
x  + a

And that's easy enough to integrate (unless, like me, you've forgotten
the tables of integrals you learnt at A-level. Fortunately Maxima
hasn't):

(%i4) E_no_b: integrate (%, x);
x
abs(a) atan(-)
a
(%o4)                           --------------
a

Ahah! Now remember what I originally said about how b gets involved and
do the substitution by hand:

(%i5) E: subst(x-b, x, %);
x - b
abs(a) atan(-----)
a
(%o5)                         ------------------
a

Of course, abs(a)/a is ±1. If you know the sign of a, you can get even
further:

(%i6) assume (a>0);
(%o6)                               [a > 0]
(%i7) E, ev;
x - b
(%o7)                             atan(-----)
a

can still cope: you just have to tell it to get rid of the square roots
by simplifying the product:

(%i8) forget (a>0);
(%o8)                               [a > 0]
(%i9) ratsimp(ex);
abs(a)
(%o9)                        --------------------
2            2    2
x  - 2 b x + b  + a
(%i10) integrate(%,x);
2 x - 2 b
abs(a) atan(---------)
2 a
(%o10)                      ----------------------
a

And you can get rid of the unfortunate factor of 2 with another call to
ratsimp if you fancy:

(%i11) ratsimp(%);
x - b
abs(a) atan(-----)
a
(%o11)                        ------------------
a

Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120102/e7daf968/attachment.pgp>
```