Re: To plot solutions, FindRoot as a function
- To: mathgroup at smc.vnet.net
- Subject: [mg37353] Re: To plot solutions, FindRoot as a function
- From: "Borut L" <gollum at email.si>
- Date: Fri, 25 Oct 2002 02:46:33 -0400 (EDT)
- References: <ap861r$53e$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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
|
|
|
|