MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Complex and Solve

  • To: mathgroup at
  • Subject: [mg125099] Complex and Solve
  • From: howard.lovatt at
  • Date: Tue, 21 Feb 2012 06:15:09 -0500 (EST)
  • Delivered-to:


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.

Thanks in advance for any advice,

 -- 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
In[7]:= impeadance=r+1/(1/rfe+1/(I \[Omega] l))//FullSimplify//ComplexExpand
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]

In[9]:= solution=Solve[irms==voltage/impeadance,{rfe,l}][[1]]//FullSimplify
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)))}

In[10]:= nsolution=NSolve[irms==voltage/impeadance,{rfe,l}]
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 : // # 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}}
In[14]:= mimpeadance=mr+Inverse[Inverse[mrfe]+Inverse[ml]]//FullSimplify
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]}}
In[16]:= mcurrent=mvoltage.Inverse[mimpeadance]//FullSimplify
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: Microarray data analysis
  • Next by Date: Re: Why the FourierTransform gives two different answers?
  • Previous by thread: Re: How add a menu item with a menu key using an init.m
  • Next by thread: Re: Complex and Solve