Re: Complex and Solve

• To: mathgroup at smc.vnet.net
• Subject: [mg125114] Re: Complex and Solve
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Wed, 22 Feb 2012 05:30:49 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201202211115.GAA08330@smc.vnet.net>

```Use Reduce rather than Solve

\$Assumptions = rfe > 0 && l > 0;

r = 1;
\[Omega] = 300;
vrms = 2;
irms = 1/2;
\[Phi] = 30 Degree;

impedance = r + 1/(1/rfe + 1/(I \[Omega] l)) // FullSimplify;

voltage = vrms (Cos[\[Phi]] + I Sin[\[Phi]]) // Simplify;

Reduce[
{irms == voltage/impedance, \$Assumptions},
{rfe, l}, Backsubstitution -> True] // ToRules

{rfe -> (17 - 4*Sqrt[3])/(-1 + 2*Sqrt[3]), l -> (1/600)*(17 - 4*Sqrt[3])}

% // N

{rfe -> 4.08741, l -> 0.0167863}

Bob Hanlon

On Tue, Feb 21, 2012 at 6:15 AM,  <howard.lovatt at gmail.com> wrote:
> Hi,
>
> I am seeing something strange when trying to use Solve to find the solution to an equation involving complex numbers. If I enter the complex numbers in the usual Cartesian form then Solve nor NSolve work. If I use the matrix form for complex numbers then Solve works. The matrix form is long winded and not obvious, so I was wondering if there was a better way - see example below particularly outputs 9 and 10?
>
> The problem seems to be that Mathematica can't manipulate the real and imaginary parts separately and the reason that the matrix form works is that it forces separate manipulation of the parts.
>
>
>  -- Howard.
>
> =========================
> Fit to inductor model (series r parallel rfe l)
> In[1]:= \$Assumptions=rfe>0&&l>0;
> In[2]:= r=1;
> In[3]:= \[Omega]=300;
> In[4]:= vrms=2;
> In[5]:= irms=1/2;
> In[6]:= \[Phi]=30 Degree;
> Conventional Mathematica - Doesn' t work!!!! - See Matrix Form below
xExpand
> Out[7]= 1+(90000 l^2 rfe)/(90000 l^2+rfe^2)+(300 I l rfe^2)/(90000 l^2+rfe^2)
> In[8]:= voltage=vrms(Cos[\[Phi]]+I Sin[\[Phi]])//Simplify//ComplexExpand
> Out[8]= I+Sqrt[3]
>
> During evaluation of In[9]:= Solve::svars: Equations may not give solutions for all "solve" variables. >>
> Out[9]= {l->-(I/(300 (1/((-1+2 I)+2 Sqrt[3])-1/rfe)))}
>
> During evaluation of In[10]:= NSolve::infsolns: Infinite solution set has dimension at least 1. Returning intersection of solutions with (151145 l/110742-(17791 rfe)/18457 == 1. >>
> Out[10]= {{rfe->-1.0368-0.0037973 I,l->0.000448264 -0.00268184 I},{rfe->2.47291 +1.99217 I,l->2.47917 +1.40697 I}}
>
> Matrix Form
> http : // en.wikipedia.org/wiki/Complex_number # Matrix_representation _of _complex _numbers
> In[11]:= mr={{r,0},{0,r}}
> Out[11]= {{1,0},{0,1}}
> In[12]:= mrfe={{rfe,0},{0,rfe}}
> Out[12]= {{rfe,0},{0,rfe}}
> In[13]:= ml={{0,-\[Omega] l},{\[Omega] l,0}}
> Out[13]= {{0,-300 l},{300 l,0}}
> Out[14]= {{1+1/(1/rfe+rfe/(90000 l^2)),-((300 l rfe^2)/(90000 l^2+rfe^2)},{(300 l rfe^2)/(90000 l^2+rfe^2),1+1/(1/rfe+rfe/(90000 l^2))}}
> In[15]:= mvoltage=vrms{{Cos[\[Phi]],-Sin[\[Phi]]},{Sin[\[Phi]],Cos[\[Phi]]}}//Simplify
> Out[15]= {{Sqrt[3],-1},{1,Sqrt[3]}}
> Out[16]= {{(Sqrt[3] rfe^2+300 l rfe^2+90000 Sqrt[3] l^2 (1+rfe))/(rfe^2+90000 l^2 (1+rfe)^2),-((rfe^2-300 Sqrt[3] l rfe^2+90000 l^2 (1+rfe))/(rfe^2+90000 l^2 (1+rfe)^2))},{(rfe^2-300 Sqrt[3] l rfe^2+90000 l^2 (1+rfe))/(rfe^2+90000 l^2 (1+rfe)^2),(Sqrt[3] rfe^2+300 l rfe^2+90000 Sqrt[3] l^2 (1+rfe))/(rfe^2+90000 l^2 (1+rfe)^2)}}
> In[17]:= mirms={{irms,0},{0,irms}}
> Out[17]= {{1/2,0},{0,1/2}}
> In[18]:= msolution=Solve[mirms==mcurrent,{rfe,l}][[1]]
> Out[18]= {rfe->(24709-15142 Sqrt[3])/(-4937+2636 Sqrt[3]),l->(-45426+24709 Sqrt[3])/(-1184400+593400 Sqrt[3])}
> In[19]:= msolution//N
> Out[19]= {rfe->4.08741,l->0.0167863}
>

```

• Prev by Date: Re: How best to implement a hash table in Mathematica
• Next by Date: Re: How best to implement a hash table in Mathematica
• Previous by thread: Complex and Solve
• Next by thread: Re: Complex and Solve