MathGroup Archive 2006

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

Search the Archive

Re: FindRoot syntax?

  • To: mathgroup at
  • Subject: [mg66537] Re: [mg66507] FindRoot syntax?
  • From: "Chris Chiasson" <chris at>
  • Date: Fri, 19 May 2006 03:39:47 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at


A three part response for you to peruse:

Personally, I think the syntax is fine. The setup would break if g had
a value, but then g[x,y] couldn't be called normally.

You might consider exploiting the structure of expressions returned by
FindRoot, especially for the one variable case. It would be easy to
use Part to take the right hand side of the rule for g.

You may find it easier (faster?) to express g as the solution to a
differential equation system instead of as a delayed rule involving
FindRoot. This has the advantage of making sure your equations do not
"jump" solutions. Carl Woll told me about this on the MathGroup. It is
called homotopic continuation.

In your case, I think the differential equations could be created as
follows (in a somewhat verbose manner for clarity). Note that I am
just typing this - I haven't tested it because I don't have the
definition of f.

f[g[1,y],1,y]==0(*taking x=1 to be one of the starting points*),
f[g[x,2],x,2]==0(*taking y=2 to be the other starting point*)


(I only show NDSolve here, because your use of FindRoot above seems to
indicate that f has some complexity which may prevent you from
obtaining a solution from DSolve)

Kind Regards,

On 5/17/06, AES <siegman at> wrote:
> I just defined an expression making use of FindRoot[] in the form
>    g[x_,y_] := g /. FindRoot[ f[g, x, y]==0, {g, 0, 1} ]
> where  f[g,x,y]  is a simple expression involving g, x, and y, and it
> seems to work just fine, churning out numerical values of g[x,y] for
> numerical inputs of x and y, with no obvious problems.
> I keep feeling guilty, however, as if I've done something sinful --
> specifically that I should be using a different symbol name or dummy
> variable in place of g on the right-hand side.
> Is this syntax really OK?


  • Prev by Date: Re: fixing contours
  • Next by Date: Re: NonlinearFit problem
  • Previous by thread: FindRoot syntax?
  • Next by thread: fixing contours