Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: To plot solutions, FindRoot as a function

  • To: mathgroup at
  • Subject: [mg37372] Re: To plot solutions, FindRoot as a function
  • From: "Peltio" <peltio at>
  • Date: Fri, 25 Oct 2002 02:48:23 -0400 (EDT)
  • Organization: Peltio Inc.
  • References: <ap861r$53e$>
  • Reply-to: "Peltio" <peltioNOSP at>
  • Sender: owner-wri-mathgroup at

"Veniamin Abalmassov" wrote:

>I'd like to plot the solution of an equation which depends on two
>parameters, e.g.

>sol[a_,b_]:=FindRoot[a*Tanh[b*x] == x, {x, {0.01, 0.1}}]
>Plot[sol[a,b], {a, 1, 2}, {b, 1, 2}]

You were almost there!
The problem is the typo (Plot instead of Plot3D) and the fact that FindRoot,
and hence sol, returns a replacement rule instead of the value of x.
You will be better off with:

    sol[a_,b_]:=x /. FindRoot[a*Tanh[b*x] == x, {x, {0.01, 0.1}}]
    Plot3D[sol[a,b], {a, 1, 2}, {b, 1, 2}]

And if you want to see the single points (here I use a grid with a spacing
of 0.05 units) you can use this, instead:


invalid address in reply, crafty decoding needed to answer in mail

  • Prev by Date: Re: Problem with user defined functions
  • Next by Date: Re: Rounding numbers
  • Previous by thread: RE: To plot solutions, FindRoot as a function
  • Next by thread: Re: To plot solutions, FindRoot as a function