MathGroup Archive 2002

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

Search the Archive

Re: To plot solutions, FindRoot as a function


Hi Veniamin,

First, there is always a trivial solution, i.e. x = 0.

You are probably interested in the additional one, yes?. Depending on the
values of a and b, it exists in Reals or it doesn't.

I would carefully avoid continuous analysis in such problems and looked for
a discrete solution. You can always increase resolution.

Here we go.

getSol[a_,b_,x_]:=FindRoot[Evaluate[a Tanh[b x] == x],
    {x,Sqrt[3 (a b-1)/(a b^3)]}]

x/.Table[getSol[a,b,x],{a,1,2,.25},{b,1,2,.25}]

ListDensityPlot[%]

(* continuous :) *)
Plot3D[Evaluate[x/.getSol[a,b,x]],{a,1,2},{b,1,2}]


A note : You should check for the critical a and b, i.e. where the
non-trivial solution vanishes. (e.g. a*b == 1). If you are thinking where
I've got the initial value for FindRoot, think twice

Series[a Tanh[b x],{x,0,3}]//Normal





Hope that helps,



Borut



"Veniamin Abalmassov" <V.Abalmassov at unibas.ch> wrote in message
news:ap861r$53e$1 at smc.vnet.net...

| Hello,
|
| I'd like to plot the solution of an equation which depends on two
| parameters, e.g.
|
| a*Tanh[b*x] == x
|
| So, I'd like to see it in 3D, one axis is "a", other is "b", and the last
| is "solution".
|
| I've tried naively to do it as follows:
|
| sol[a_,b_]:=FindRoot[a*Tanh[b*x] == x, {x, {0.01, 0.1}}]
| Plot[sol[a,b], {a, 1, 2}, {b, 1, 2}]
|
| And it doesn't work. Help me, please. What can I do?
|
| Thanks a lot,
|
| Veniamin
|
|
|
|




  • Prev by Date: RE: help on bootstrap sample
  • Next by Date: Re: Problem with user defined functions
  • Previous by thread: Re: To plot solutions, FindRoot as a function
  • Next by thread: Re: To plot solutions, FindRoot as a function