Quantcast
Channel: Magnitude is returning a complex number if I precede it with Complex Expand? - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 2

Magnitude is returning a complex number if I precede it with Complex Expand?

$
0
0

I define a function called VoutCoin:

VoutCoin[Mut_, \[Omega]_, Lc_, Rc_] = ComplexExpand[Abs[I1coin* (j \[Omega] L1 + (j \[Omega] Mut)^2/(j \[Omega] Lc + Rc))]] /. values

I have the suffixes and the values defined:

M = 10^6;k = 10^3;m = 10^-3;u = 10^-6;n = 10^-9;pf = 10^-12;values = {R1 -> 180,C1 -> 9.4 n,L1 -> 1.7 m,Vin -> LaplaceTransform[Cos[2*\[Pi]*138 k*t - \[Pi]], t, s]};j = I;s = j*\[Omega];

if I invoke the function as defined above with the following arguments, I get:

In[1030]:= VoutCoin[.5, 2*\[Pi]*10 k, 10 u, .1]Out[1030]= {0. + 8.40133*10^-8 I}

if I remove the ComplexExpand preceding the Abs in the function, I get:

VoutCoin[Mut_, \[Omega]_, Lc_, Rc_] = Abs[I1coin* (j \[Omega] L1 + (j \[Omega] Mut)^2/(j \[Omega] Lc + Rc))] /. values // SimplifyIn[1095]:= VoutCoin[.5, 2*\[Pi]*10 k, 10 u, .1]Out[1095]= {8.40133*10^-8}

What is going on? Why would ComplexExpand[Abs[]] return a complex numnber?

In case anyone wants plugs this into Mathematica, I'm including I1coin below

In[1092]:= I1coin = I1 /. sol1Out[1092]= {(Vin (Rc + I Lc \[Omega]))/(Mut^2 \[Omega]^2 - (-R1 + I/(C1 \[Omega]) - I L1 \[Omega]) (Rc + I Lc \[Omega]))}

Thank you in advance for your help....

--------Edit Per Request_----------------------

M = 10^6;k = 10^3;m = 10^-3;u = 10^-6;n = 10^-9;pf = 10^-12;values = {R1 -> 180,C1 -> 9.4 n,L1 -> 1.7 m,Vin -> LaplaceTransform[Cos[2*\[Pi]*138 k*t - \[Pi]], t, s]};j = I;s = j*\[Omega];eq1 = Vin - I1 (R1 + 1/(j \[Omega] C1) + j \[Omega] L1) -j \[Omega] Mut I2 == 0;eq2 = I2 (j \[Omega] Lc + Rc) + j \[Omega] Mut I1 == 0;sol1 = Solve[eq1 && eq2, {I1, I2}]I1coin = I1 /. sol1VoutCoin[Mut_, \[Omega]_, Lc_, Rc_] = ComplexExpand[Abs[I1coin* (j \[Omega] L1 + (j \[Omega] Mut)^2/(j \[Omega] Lc + Rc))]] /. values // Simplify In[1159]:= VoutCoin[.5, 2*\[Pi]*10 k, 10 u, .1] Out[1159]= {0. + 8.40133*10^-8 I}

Question is about result out[1159] --- I don't understand why Mathematica returns a complex number for a magnitude. It seems to happen when I precede Abs with ComplexExpand


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images