Re: Re: Two FindRoot questions

*To*: mathgroup at smc.vnet.net*Subject*: [mg89888] Re: Re: [mg89872] Two FindRoot questions*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Tue, 24 Jun 2008 03:21:16 -0400 (EDT)*Reply-to*: hanlonr at cox.net

Or you could put the SetPrecision inside the function definition Clear[f]; f[k_ /; k <= 0] := x /. FindRoot[x^2 + SetPrecision[k, 20], {x, 0, 10}, WorkingPrecision -> 20]; {f[-10], f[10]} {3.1622776601683793320,f(10)} Plot[f[k], {k, -10, 10}] Bob Hanlon ---- Bob Hanlon <hanlonr at cox.net> wrote: > Clear[f]; > > f[k_ /; k <= 0] := > x /. FindRoot[x^2 + k, {x, 0, 10}, WorkingPrecision -> 20]; > > {f[-10], f[10]} > > {3.1622776601683793320,f(10)} > > Plot[f[SetPrecision[k, 20]], {k, -10, 10}] > > > Bob Hanlon > > ---- Aaron Fude <aaronfude at gmail.com> wrote: > > Hi, > > > > These are not FindRoot questions, per se... > > > > Here's a simple example which I want to ask three questions about: > > > > f[k_] := x /. FindRoot[x^2 + k, {x, 0, 10}]; > > f[-10] > > Plot[f[k], {k, -10, 10}] > > > > First, I want the plot to only show where there exists a root. > > Is the right solution to make f[] return Null? > > How do I make f[] return Null? (Is there a way to "catch" the > > warnings?) > > > > Finally, I need to solve my equations to 20 digits. How do I do that? > > I've read about Accuracy and Precision but it didn't help. > > > > Thanks! > >