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


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

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:18 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jaqecp$nkd$1@smc.vnet.net> (permalink)
References <jalbrn$sib$1@smc.vnet.net> <201111250959.EAA11288@smc.vnet.net>

Show all headers | View raw


Clear[digits]
digits[precision_] := Module[{x, root},
   root = x /.
     Quiet@FindRoot[f12[x], {x, 1, 3.4}, Method -> "Brent",
       WorkingPrecision -> precision, MaxIterations -> 250];
   Replace[
    RealDigits@N[root, precision] - RealDigits@N[Sqrt@E, precision] //
     First, {x : Longest[0 ..], ___} :> Length@{x}]
   ]
digits@75
ListPlot[{#, digits@#} & /@ Range[17, 80]]

Bobby

On Fri, 25 Nov 2011 03:59:24 -0600, HwB <hwborchers@googlemail.com> wrote:

> Okay, with the help of Fred Simons, Netherlands, I realized that the
> magic keyword here is "WorkingPrecision" --- though I don't understand
> how to know an appropriate value for it in advance (I am not using
> Mathematica on a regular basis). At least, Mathematica itself is
> requesting more iterations if necessary.
>
>    SetPrecision[
>        x /. FindRoot[f12[x], {x, 1, 3.4}, Method -> "Brent",
>        WorkingPrecision -> 75, MaxIterations -> 250], 20]
>
>    1.6487212707001281468
>
> Still, I find it strange that Mathematica cannot solve this expression
> symbolically.
>
> Regards
> Hans Werner
>
>
> On Nov 24, 1:04 pm, HwB <hwborch...@googlemail.com> 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, PrecisionGoa=
> l -> 20], 16]
>>     # 1.648732212532746
>>     SetPrecision[
>>         x /. FindRoot[f12[x], {x, 1.0, 3.4}, Method -> "Secant",
>>                  AccuracyGoal -> Infinity, PrecisionGoa=
> l -> 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@yahoo.com

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


Thread

Root finding needs higher accuracy HwB <hwborchers@googlemail.com> - 2011-11-24 12:04 +0000
  Re: Root finding needs higher accuracy "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-25 09:55 +0000
  Re: Root finding needs higher accuracy Peter Falloon <pfalloon@gmail.com> - 2011-11-25 10:04 +0000
  Re: Root finding needs higher accuracy HwB <hwborchers@googlemail.com> - 2011-11-25 10:10 +0000
  Re: Root finding needs higher accuracy DrMajorBob <btreat1@austin.rr.com> - 2011-11-26 10:16 +0000
  Re: Root finding needs higher accuracy DrMajorBob <btreat1@austin.rr.com> - 2011-11-26 10:18 +0000
  Re: Root finding needs higher accuracy Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2011-11-26 11:49 +0000
  Re: Root finding needs higher accuracy Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2011-12-06 03:06 +0000

csiph-web