Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg123215] Re: Root finding needs higher accuracy
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sat, 26 Nov 2011 06:48:22 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jalbrn$sib$1@smc.vnet.net> <201111250959.EAA11288@smc.vnet.net>

On 25 Nov 2011, at 10:59, HwB 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

I don't find strange at all. Human being do this essentially by guessing 
the answers: how can you expect Mathematica to do the same? What 
Mathematica can do, and this is quite remarkable, is to solve the 
equation "exactly". The following answer is an "exact answer", not an 
approximate one:

sols =
x /. Solve[Log[x] + x^2/(2 Exp[1]) - 2 x/Sqrt[Exp[1]] + 1 == 0, x,

  Reals]

{Root[{4 #1-4 Sqrt[E]&,1.64872127070012814685}],Root[{4 #1-4 
Sqrt[E]&,1.64872127070012814685}],Root[{4 #1-4 
Sqrt[E]&,1.64872127070012814685}]}

This is entirely different from finding the roots approximately; here 
Mathematica actually proves that there are exactly three roots and that 
they are equal. The presence of approximate numbers in the answer does 
not mean that the answer itself is approximate, in fact it can be 
computed to arbitrary precision:

In[10]:= N[First[sols], 100]

Out[10]= =
1.648721270700128146848650787814163571653776100710148011575079311640661021194215608632776520056366643

You can replace 100 by 1000 if you like. This answer is different from but not in any respect worse than Sqrt[E], which is what you surely expected. Mathematica does not notice the possibility of a further simplification because in the case of transcendental roots it does not attempt to simplify the pure function inside the root object, as it would do in an algebraic case, e.g.

Root[4 #1-4 Sqrt[E]&,1]

Sqrt[E]

Probably this is because the number of situations in which this would be useful is  small, but there might also be some other reason. Anyway, it is just possible that this is one respect in which Reduce could be improved, i.e. it could simplify things like

Root[{#1-Sqrt[2]&,1.414213562373095}]

To

Sqrt[2]

as it does in the algebraic case.

Of course it is possible to "guide" Mathematica to the desired answer, e.g.

eq =  x^2/(2*E^1) - (2*x)/Sqrt[E^1] + Log[x] + 1 == 0;

eq1 = eq /. x -> Sqrt[E]*u
u^2/2 - 2*u + Log[Sqrt[E]*u] + 1 == 0

Reduce[eq1, u, Reals]
u==1

Andrzej Kozlowski




  • Prev by Date: ListPlot3D equal distance between ticks
  • Next by Date: Re: Matrices as operators
  • Previous by thread: Re: Root finding needs higher accuracy
  • Next by thread: Re: Root finding needs higher accuracy