Maple - Convert to complex

104 Views Asked by At

I need to convert $ \dfrac{1}{2x^{3}+x^{2}+2x} $ to $\dfrac{1}{2x} + \dfrac{\dfrac{-1}{4}+I\dfrac{\sqrt{15}}{60}}{x+\dfrac{1}{4}-\dfrac{I\sqrt{15}}{4}}+\dfrac{\dfrac{-1}{4}-I\dfrac{\sqrt{15}}{60}}{x+\dfrac{1}{4}-\dfrac{I\sqrt{15}}{4}} $ where I is imaginary

When I try to do

$f:= \dfrac{1}{2x^{3}+x^{2}+2x}$

$convert(f, parfrac, complex):$

It turns into a bunch of floating numbers such as:

$ \dfrac{(-.2500000000-0.6454972245*I)}{(x+.2500000000+.9682458366*I)}$ $ +\dfrac{(-.2500000000+0.6454972245e-1*I)}{(x+.2500000000-.9682458366*I)} $ $+ \dfrac{.5000000000}{x} $

3

There are 3 best solutions below

2
On

You first solve

$$2x^{3}+x^{2}+2x=x(2x^2+x+2)=0 \tag{1}$$

and obtain 3 roots $a,b,c$

$$a=0,b=(1/4)(-1+i\sqrt{15}),c=(1/4)(-1-i\sqrt{15})\tag{1B}$$

i.e.

$$2x^{3}+x^{2}+2x=2(x-a)(x-b)(x-c)\tag{2}$$

Then you can assume

$$\frac{1}{2x^{3}+x^{2}+2x}=\frac{A}{x-a}+\frac{B}{x-b}+\frac{C}{x-c}\tag{3}$$

Multiply (2) by (3) and obtain

$$1=2A(x-b)(x-c)+2B(x-a)(x-c)+2C(x-a)(x-b)\tag{4}$$

You can then set coefficients of $x^0,x^1,x^2$ to be zero to solve for $A,B,C$ and obtain:

$$A=\frac{1}{2(a-b)(a-c)},B=\frac{1}{2(b-a)(b-c)},C=\frac{1}{2(c-a)(c-b)}\tag{5}$$

Substitution of (1B) into (5) leads to:

$$A=\frac{1}{2}$$ $$B=\frac{-4i}{15+i\sqrt{15}}=-\frac{1}{4}\left(1+\frac{i}{\sqrt{15}}\right)$$ $$C=\frac{+4i}{15-i\sqrt{15}}=-\frac{1}{4}\left(1-\frac{i}{\sqrt{15}}\right)$$

This method (from (2) through (5)) is quite general. It does not depend on the actual values of 3 roots $a,b,c$.

1
On

Here's how to do it in Maple. You need to provide a field extension for the splitting field of the denominator because it's not implied by the coefficients.

restart:
d:= 2*x^3+x^2+2*x:
factor(d);
select(x-> degree(x)>1, %);
factor(d, RootOf(%, index= 1));
convert(1/%, parfrac, x);
allvalues(%);
0
On

You could fix up Carl's response (which I consider as a good one), manually or with code.

Ie, using code, you could use subsop to replace terms in the final sum with their equivalents without the undesired leading rational coefficients.

In any computed solution (including Carl's and those below) you may also have the difficulty that the terms in the final sum may be out of order. The order of terms in a sum may be session dependent. Forcing how the sum displays can be trickier to deal with that just distributing some coefficients through products, and I will leave that alone here.

For your particular answer, the following work (up to sum term ordering), with your expected coefficients throughout I believe.

restart:

d:=2*x^3+x^2+2*x:

allvalues(convert(1/d,fullparfrac,x));

             1    1     (1/2)      1    1     (1/2)       
           - - + -- I 15         - - - -- I 15            
             4   60                4   60               1 
           ------------------- + ------------------- + ---
               1   1     (1/2)       1   1     (1/2)   2 x
           x + - - - I 15        x + - + - I 15           
               4   4                 4   4                

identify(convert(1/d,parfrac,x,complex));

       1    1    (1/2)  (1/2)      1    1    (1/2)  (1/2)       
     - - + -- I 3      5         - - - -- I 3      5            
       4   60                      4   60                     1 
     ------------------------- + ------------------------- + ---
         1   1    (1/2)  (1/2)       1   1    (1/2)  (1/2)   2 x
     x + - - - I 3      5        x + - + - I 3      5           
         4   4                       4   4