MathGroup Archive 2008

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

Search the Archive

Re: Help with find root needed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88980] Re: Help with find root needed
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 22 May 2008 06:17:21 -0400 (EDT)
  • References: <g11r1s$a95$1@smc.vnet.net>


Hi Aaron,

the slope at strating point 10 is too large and the algorithm 

overshoots. Choose a better starting point, e.g. Max[1,gamma]

Further, if the root is near 1 you must allow Mathematica to search around 1. 

Simply change {z,10,1,10} to {z,10,0.5,10}. Here is the correction:

K[h_,\[Gamma]_]:=z/.FindRoot[f[z,h,\[Gamma]]==0,{z,Max[1,\[Gamma]],0.5,10}];

hope this helps, Daniel





Aaron Fude wrote:

> Hi,

> 

> In what follows, I'm looking for the largest root of a function, that

> is also a function of two parameters. The Manipulate command shows me

> that the root is consistently there (albeit near a singularity which

> might be what's causing problems). However, FindRoot doesn't find it

> as the plot shows. I get one error, but my guess is that it's

> referring to one particular point on the plot.

> 

> f[z_, h_, \[Gamma]_] :=

>   Tanh[h*z] + (\[Gamma]^2 + 1 - z^2)/(\[Gamma]^2 - 1 - z^2) *

>     z/\[Gamma];

> Manipulate[

>  Plot[f[z, h, \[Gamma]], {z, 0, 10}], {h, .1, 10}, {\[Gamma], .1,

>   10}]

> K[h_, \[Gamma]_] :=

>   z /. FindRoot[f[z, h, \[Gamma]] == 0, {z, 10, 1, 10}];

> Plot3D[K[h, \[Gamma]], {h, .1, 10}, {\[Gamma], .1, 10}]

> 

> Many thanks in advance!

> 

> Aaron

> 





-- 



Daniel Huber

Metrohm Ltd.

Oberdorfstr. 68

CH-9100 Herisau

Tel. +41 71 353 8585, Fax +41 71 353 8907

E-Mail:<mailto:dh at metrohm.com>

Internet:<http://www.metrohm.com>




  • Prev by Date: Re: Problems with ListPlot
  • Next by Date: Re: Interpolation and plot doing strange things with mathematica
  • Previous by thread: Re: Help with find root needed
  • Next by thread: Plotting a series of piecewise functions