Maple complex exponential form to algebraic.

1.2k Views Asked by At

How can I easily convert complex number from exponential or trigonometric form to algebraic?

Update

In fact I'm trying to simplify this expression: exoression

The only way I see is to convert to trigonometric form then expand but I can't make Maple calculate cos and sin. So how can I do this?

My code:

restart; w1 := 100; L2 := 100*10^(-3); L3 := L2; L5 := 200*10^(-3); C6 := (200/3)*10^(-6); psi1 := 32.5 degrees;
Z6 := -I/(w1*C6);
Z5 := I*w1*L5;
Z2 := I*w1*L2;
Z1 := 75;
Z3 := I*w1*L3;
Z4 := 75;
Z7 := 75;
eq := {Imk-(U1-U2)/Z2-(U2-U3)/Z1 = 0, U1/Z4+U1/(Z5+Z6+Z7)+U3/Z3 = 0, (U1-U2)/Z2-U1/(Z5+Z6+Z7)-U1/Z4 = 0};

a := solve(eq, {U1, U2, U3});
U1 := eval(U1, a);
U1 := convert(U1, float);

Imk1 := [.575, .868*exp(I*psi1), -.366, .243, -.183];
Ink := Array(1 .. 5);

for n to 5 do 
    Ink[n] := simplify((32.14738845-6.185240008*I)*Imk1[n]/(Z5+Z6+Z7))     
end do; 

Ud := 0; 
for n to 5 do: 
     Ud := Ud+(1/2)*Ink[n]^2 
end do;

Ud := simplify(sqrt(Ud), sqrt);

print(Ink[2]); 
expand(convert(Ink[2], trig));
2

There are 2 best solutions below

8
On BEST ANSWER

$$z=|z|\exp(i\phi)=|z|\left(\cos \phi+i\sin \phi\right)=|z|\cos \phi +i|z|\sin \phi$$

Hence $x=|z|\cos \phi$ and $y = |z|\sin \phi$.

This is one way to do it in Maple:

G:=1+2*I;
#convert cartesian to polar
G__polar:=convert(G,polar);
#convert polar to cartesian
G__cartesian:=evalc(G__polar);
1
On

Your code posted here as plaintext code contains the following statement,

psi1 := 32.5 degrees;

That is not valid 1D Maple Notation code. In typeset 2D Input that space between 32.5 and degrees can mean implicit multiplication, and perhaps that's what you meant here too. As plaintext 1D Maple Notation that is invalid syntax, however. You can get a great deal of confusion by pasting snippets of 2D Input as (ostensible) fragments of plaintext 1D Maple Notation code. Please clarify it for us.

If your actual code is simply using the name degrees as if it were any other name, like, say,

psi1 := 32.5*degrees;

then you can replace that name within Ink with a command like,

subs(degrees=Pi/180, Ink);

And of course you can evaluate that to floating-point, as say,

evalf(subs(degrees=Pi/180, Ink));

Note that the name degrees does not have much special meaning in Maple, and certainly does not mean units of arc-degree, in general. You can get a limited amount of use out of the Unit(degree) construct, however. Try you code with, say,

psi1 := 32.5 * Unit(degrees);

and see the effect. The simplify command knows how to combine and (sometimes) resolve dimensions for simplifying expressions involving Units. See also the Units,Standard help-page.