Re: FindRoot problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg40073] Re: FindRoot problem*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Tue, 18 Mar 2003 05:50:47 -0500 (EST)*Organization*: Universitaet Leipzig*References*: <b51ac2$34o$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de*Sender*: owner-wri-mathgroup at wolfram.com

Hi, can yo tell me what's the derivative of f[x]=Sec[x] - 0.0018167 (Sec[x] - 1) - 0.002875 (Sec[x] - 1)^2 - 0.000808 (Sec[x] - 1)^3 for x>=0 and x <=1.54 at x==0 ? or at x==2 ? Mathematica can't and so it can't use the Newton method to find the solution. To force FindRoot[] to use the secand method you have to give an interval that brackets the root but you can also not give such a interval. So you get an error message. Regards Jens "Pigeon, Robert" wrote: > > Good day, > I have a problem with FindRoot that I do not understand, so I am > asking for help! I have a function defined as a Module. I use FindRoot to > find a root when the function is given a value. Everything works fine > except when I put a condition to my function, when I do I get an error > message. Here what I try to do: > > f[x_]:= Module[{}, Sec[x] - 0.0018167 (Sec[x]-1) - 0.002875 (Sec[x]-1)^2 - > 0.000808 (Sec[x]-1)^3 ]; > f::usage="explanation of f"; > > If I do > FindRoot[f[x]==10,{x,1.4}] > I get > {x->1.53501} > All that is correct. > > But now if I do > f[x_ /; x>= 0 && x<= 1.54]:= same as above > and I try to find the root the same way, I get an error message > FindRoot[f[x]==10,{x,1.4}] > I get > FindRoot::frjc: Could not symbolically find the Jacobian of {f[x]-10. Try > giving two starting values for each variable. > > I tried putting my conditions inside the Module, after the Module. I tried > to use Which, If. But, as soon as I put a condition, I get the same error. > > Any idea ??? > > Thanks, > > Robert