MathGroup Archive 2011

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

Search the Archive

Re: Root finding needs higher accuracy

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123208] Re: Root finding needs higher accuracy
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sat, 26 Nov 2011 05:09:20 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201111241157.GAA29024@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

Harvey,

Sadly, that result is correct to just 16 decimal places:

root = x /.
   FindRoot[Log[x] + x^2/(2 Exp[1]) - 2 x/Sqrt[Exp[1]] + 1 == 0, {x,
     1}, WorkingPrecision -> 50]
Replace[RealDigits@N[root, 25] - RealDigits@N[Sqrt@E, 25] //
   First, {x : Longest[0 ..], ___} :> Length@{x}]

1.6487212707001280730589817271865607686229236280618

16

Increasing WorkingPrecision to 80 throws FindRoot::cvmit and gets us two  
decimals closer:

root = x /.
   FindRoot[Log[x] + x^2/(2 Exp[1]) - 2 x/Sqrt[Exp[1]] + 1 == 0, {x,
     1}, WorkingPrecision -> 80]
Replace[RealDigits@N[root, 25] - RealDigits@N[Sqrt@E, 25] //
   First, {x : Longest[0 ..], ___} :> Length@{x}]

1.64872127070012814492925334035434741717247563420986813745794650261295\
21442685296

18

Bobby

On Fri, 25 Nov 2011 03:56:08 -0600, Harvey P. Dale <hpd1 at nyu.edu> wrote:

> Hans:
>
> 	The option you need is WorkingPrecision.
>
> FindRoot[Log[x]+x^2/(2 Exp[1])-2
> x/Sqrt[Exp[1]]+1==0,{x,1},WorkingPrecision->50]
>
> 	Best,
>
> 	Harvey
>
>
> -----Original Message-----
> From: HwB [mailto:hwborchers at googlemail.com]
> Sent: Thursday, November 24, 2011 6:57 AM
> To: mathgroup at smc.vnet.net
> Subject: Root finding needs higher accuracy
>
> I would like to numerically find the root of the following function with
> up to 20 digits.
>
>     f12[x_] := Log[x] + x^2 / (2 Exp[1]) - 2 x / Sqrt[Exp[1]] + 1
>
> This problem is known to be difficult for solvers in double precision
> arithmetics. I thought it should be easy with Mathematica, but the
> following attempts were not successful.
>
>     SetPrecision[
>         x /. FindRoot[f12[x], {x, 1.0, 3.4}, Method -> "Brent",
>                  AccuracyGoal -> Infinity, PrecisionGoal -> 20], 16]
>     # 1.648732212532746
>     SetPrecision[
>         x /. FindRoot[f12[x], {x, 1.0, 3.4}, Method -> "Secant",
>                  AccuracyGoal -> Infinity, PrecisionGoal -> 20], 16]
>     # 1.648710202030051
>
> The true root obviously is Sqrt[Exp[1]]//N = 1.648721270700128...
>
> The symbolic solver explicitely says it cannot solve this expression.
> What do I need to do to get a much more exact result out of Mathematica?
>
> Many thanks, Hans Werner
>
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: Root finding needs higher accuracy
  • Next by Date: Re: Root finding needs higher accuracy
  • Previous by thread: Re: Root finding needs higher accuracy
  • Next by thread: Re: Root finding needs higher accuracy