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


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

Re: Root finding needs higher accuracy

From Andrzej Kozlowski <akoz@mimuw.edu.pl>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Root finding needs higher accuracy
Date 2011-11-26 11:49 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jaqjo8$ojc$1@smc.vnet.net> (permalink)
References <jalbrn$sib$1@smc.vnet.net> <201111250959.EAA11288@smc.vnet.net>

Show all headers | View raw


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

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