Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

FindRoot question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5424] FindRoot question
  • From: pherron at gsb-ecu.Stanford.EDU (Michael C. Herron)
  • Date: Sat, 7 Dec 1996 00:25:54 -0500
  • Organization: Graduate School Of Business, Stanford University
  • Sender: owner-wri-mathgroup at wolfram.com

I have a question concerning efficient use of FindRoot.

Consider the following code:

h=.5

k=1

f=.2

j2[t_,b_]:= -(2*h*k - 4*b*h*k + b*h^2*k + 2*b*h*k^2 - 4*f*t + 4*b*f*t - 2*b*f*k*t +  b*h*k*t)/(2*(2 - 2*b + b*k)*(-h + t))   

j3[t_,b_]:=N[Which [j2[t,b]<0,0,j2[t,b]>1,1,True,j2[t,b]]]

j4[z_]:=N[Integrate[b j3[z,b],{b,0,1}]]

This works fine.  j2 defines a function, j3 truncates it at 0 and 1,
and j4 integrates j3 with respect to one of its arguments.  Nothing
complicated here.

If I do:

Plot [z j4[z]-f,{z,0,1}]

I get a nice upward sloping graph that clearly crosses the horizontal
axis at about z=.4.  So, z=.4 is approximately a real root.

Next, I try:

FindRoot [z j4[z]-f,{z,.4}]

But (and this is the problem) mathematica just sits there.  I presume
it is calculating, but I have been waiting for over 15 minutes and it
is still grinding away, this despite the fact that my guess at the
root (.4) is alomost correct.  Am I doing something wrong?  Is there
an easier way to get mathematica to calculate roots?

Thanks.

Michael



  • Prev by Date: Re: select a range of elements from a nested list
  • Next by Date: losing unconvergent roots in FindRoot
  • Previous by thread: Greek Letters subscript shortcut
  • Next by thread: Re: FindRoot question