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 2005

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

Search the Archive

rootsearch in a piecewise function

  • To: mathgroup at
  • Subject: [mg60247] rootsearch in a piecewise function
  • From: juejung <juejung at>
  • Date: Thu, 8 Sep 2005 04:53:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

hi group,

why does the root search in the following piecewise function not work,  
when the plot function before evaluates just fine.
if i use the /.para already at the point where i define f2 and f3 then the  
root command works. however, the actual functions f2 and f3 are much  
longer and i would like to replace parametervalues only at the point where  
i do in the example below. it seems that findroot is evaluated before the  
replacement takes place??


para = {a -> 3, b -> 4, c -> 20, d -> 1.5};
f2[x_] := 10 + a* x^(1/2) - x - b;
f3[x_] := -6 + c/x + d^2;
f1[x_] := Which[0 < x < b, f2[x], b <= x < 10, f3[x],10 <= x, x^(1/2)]  
df1[x_] = D[f1[x], x];

Plot[f1[x] /.para, {x, 0.1, 15}]
Plot[df1[x] /.para, {x,0.1, 15}]

FindRoot[{f1[x] == 0} /.para, {x, 2}]
FindRoot[{df1[x] == 0} /.para, {x, 2}]

  • Prev by Date: Re: Gauss elimination
  • Next by Date: Re: Three piece function
  • Previous by thread: Re: Solution from Reduce as boundaries for Distribution
  • Next by thread: Hardware question