MathGroup Archive 2000

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

Search the Archive

FindRoot with two equations

  • To: mathgroup at
  • Subject: [mg24885] FindRoot with two equations
  • From: AES <siegman at>
  • Date: Sat, 19 Aug 2000 04:45:57 -0400 (EDT)
  • Organization: Stanford University
  • Sender: owner-wri-mathgroup at

I'm working with a lengthy function fC  that contains many variables x1, 
x2, x3, . . ., all purely real, but with some explicit I's in the 
formula (the "Sqrt[-1]" kind of I).  

I want to set the variables x3, x4, and upward to fixed values, and then 
solve for values of x1, x2 that make f=0.

I break fC into its real and imaginary parts that are functions of x1 
and x2 only by creating a rule

      myValues = {x3->x30,  x4->x40,  etc}

and then breaking fC into real and imaginary parts using [1]

      fR[x1_, x2_]  =  ComplexExpand[Re[fC]] /. myValues
      fI[x1_, x2_]  =  ComplexExpand[Im[fC]] /. myValues

At this point I should have two equations in two unknowns, so I try

      FindRoot[{ fR[x1, x2] == 0, fI[x1, x2] == 0}, {x1, x10}, {x2, x20}]

Several hours of messing with different approaches to this produce 
different variations on the error message

      FindRoot :: "frnum": "Function  is not a length 2 list of 
      numbers at (X1, x2) = (x10, x20)"

I've done all the checks on my formulas and expressions I can think of 
-- is there some secret I'm missing here?

Thanks   siegman at

[1]  As a cranky side note, there must a special slot somewhere for 
whoever thought up the ComplexExpand[Re[fC]] notation -- instead of the 
much more intuitive syntax Re[ComplexExpand[fC]] -- and then (so far as 
I can find) documented it nowhere in the Mathematica manual or Help messages.

  • Prev by Date: Re: Annoying Little Problem
  • Next by Date: RE: A simple problem
  • Previous by thread: Re: opening files
  • Next by thread: Surface Graphics versus Graphics3D features