 
 
 
 
 
 
Re: How can I use FindMaximum to get a result better than MachinePrecision?
- To: mathgroup at smc.vnet.net
- Subject: [mg127958] Re: How can I use FindMaximum to get a result better than MachinePrecision?
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Wed, 5 Sep 2012 03:09:10 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <20120904095037.527DA6332@smc.vnet.net>
expr = 8 E^(-x) Sin[x] - 1;
FindMaximum[expr, {x, 0, 8}] //
 InputForm
{1.5791755355586754, {x -> 0.7853981516735594}}
FindMaximum[expr, {x, 0, 8},
  AccuracyGoal -> 20, PrecisionGoal -> 20] //
 InputForm
{1.5791755355586754, {x -> 0.7853981553245005}}
Precision[%]
MachinePrecision
>From documentation for AccuracyGoal:
"In most cases, you must set WorkingPrecision to be at least as large
as AccuracyGoal. "
>From documentation for PrecisionGoal:
"In most cases, you must set WorkingPrecision to be at least as large
as PrecisionGoal. "
FindMaximum[expr, {x, 0, 8},
  AccuracyGoal -> 20, PrecisionGoal -> 20,
  WorkingPrecision -> 20] // InputForm
{1.579175535558675594017576308550564195414708583669983385\
2472`20., {x -> 0.785398163420404303959134242845118197357\
3041737258458441009`20.}}
Precision[%]
20.
>From documentation for WorkingPrecision:
"Even if internal computations are done to n-digit precision, the
final results you get may have much lower precision. "
FindMaximum[expr, {x, 0, 8},
  WorkingPrecision -> 20] // InputForm
{1.579175535558675594017576301475807582647461879911073128\
3986`20., {x -> 0.7853981634204044}}
Precision[%]
MachinePrecision
FindMaximum[expr, {x, 0, 8},
  WorkingPrecision -> 25] // InputForm
{1.579175535558675594018935476273188075390077304522331264\
0472`25., {x -> 0.785398163397457286632920167624848350070\
0473014719814661246`25.}}
Precision[%]
25.
Bob Hanlon
On Tue, Sep 4, 2012 at 5:45 AM, David Kirkby <drkirkby at gmail.com> wrote:
> I've tried this:
>
> In[2]:= FindMaximum[8 E^(-x) Sin[x] -1,{x,0,8}]
>
> Out[2]= {1.57918, {x -> 0.785398}}
>
>
> Then played around to try to get a more accurate result.
>
> In[9]:= FindMaximum[8 E^(-x) Sin[x] -1,{x,0,8},AccuracyGoal->20, PrecisionGoal->20]
>
> Out[9]= {1.57918, {x -> 0.785398}}
>
> In[10]:= Precision[%]
>
>
> Also:
>
>
> In[7]:= N[FindMaximum[8 E^(-x) Sin[x] -1,{x,0,8},AccuracyGoal->200, PrecisionGoal->200],100]
>
> Out[7]= {1.57918, {x -> 0.785398}}
>
> In[8]:= Precision[%]
>
> Out[8]= MachinePrecision
>
>
> Any suggestions?
>
- References:
- How can I use FindMaximum to get a result better than MachinePrecision?
- From: David Kirkby <drkirkby@gmail.com>
 
 
- How can I use FindMaximum to get a result better than MachinePrecision?

