Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6764

Re: Root finding needs higher accuracy

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Root finding needs higher accuracy
Date 2011-11-26 10:16 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jaqear$nju$1@smc.vnet.net> (permalink)
References <201111250957.EAA11210@smc.vnet.net>

Show all headers | View raw


The poster wanted 25 digit accuracy, and WorkingPrecision->20 yields only  
6 correct digits:

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

1.6487220277297822898

6

Bobby

On Fri, 25 Nov 2011 03:57:35 -0600, Bill Rowe <readnews@sbcglobal.net>  
wrote:

> On 11/24/11 at 6:57 AM, hwborchers@googlemail.com (HwB) wrote:
>
>> 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?
>
> On my machine the simple naive approach seems to work fine. That is
>
> In[25]:= FindRoot[f12[x], {x, 2}, WorkingPrecision -> 20]
>
> Out[25]= {x->1.6487220277297822898}
>
> In[26]:= $Version
>
> Out[26]= 8.0 for Mac OS X x86 (64-bit) (October 5, 2011)
>
>


-- 
DrMajorBob@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Root finding needs higher accuracy DrMajorBob <btreat1@austin.rr.com> - 2011-11-26 10:16 +0000

csiph-web