Maxima is adding an unnecessary %i in taylor series

82 Views Asked by At

I'm using Maxima 5.44. In the taylor expansion of a radical, Maxima introduce an unnecessary imaginary unit.

I'm trying the following calculation:

rr:sqrt(1-a*cos(θ)^2); taylor(rr, θ, 0, 2);

The result is:

sqrt(a-1)*%i-(sqrt(a-1)*%i*a*θ^2)/(2*a-2)+...

Even though it's correct the imaginary unit is annoying as everything will be computed in the real line. I would have preferred:

sqrt(1-a)-(sqrt(1-a)*a*θ^2)/(2*a-2)+...

as it will be shorter and more clear. Is there a way to force maxima not to insert the imaginary unit? I tried with assume(a<1) but it didn't work. For example sympy don't introduce this additional imaginary unit.

This is part to a larger calculation, of course. Thanks in advance.

1

There are 1 best solutions below

0
On

This is the best solution I have found so far. (I recognize that even this is imperfect.) Credit to Barton Willis for this.

(%i1) block([taylor_simplifier : rootscontract], taylor (sqrt (1 - a*cos(θ)^2), θ, 0, 2));
                                             2
                          (sqrt(- a + 1) a) θ
(%o1)/T/  sqrt(- a + 1) - -------------------- + . . .
                                2 a - 2

EDIT: Another way I found, via the flag radexpand.

(%i1) radexpand: false $

(%i2) taylor (sqrt (1 - a*cos(x)), x, 0, 2);
                                             2
                          (sqrt(- a + 1) a) x
(%o2)/T/  sqrt(- a + 1) - -------------------- + . . .
                                4 a - 4
(%i3)