Re: problems with precision
- To: mathgroup at smc.vnet.net
- Subject: [mg7663] Re: problems with precision
- From: Daniel Lichtblau <danl>
- Date: Thu, 26 Jun 1997 01:36:49 -0400 (EDT)
- Organization: Wolfram Research, Inc.
- Sender: owner-wri-mathgroup at wolfram.com
Axel Breuer wrote: > > Hello, > > I am a french student doing a trainee on mathematica. There is another > team having the same project as I have but it's working with Maple. > We had to calculate with high accuracy (more than 20 digits) the solution > of a 2 dimensional non-linear system. The problem to solve was very easy. > But Maple and Mathematica agreed only on the 15 first digits. I used the > function SetPrecision. Is there another function to set calculus precision > ? > > Here is the listing of my routine in Mathematica : > > rr=Table[FindRoot[{x+Cos[y]*Sinh[x]==0,y+Sin[y]*Cosh[x]==0},{x,N[Abs[Cos[(2*p-1)*Pi+Pi/4]]Sqrt[((2*p-1)*Pi+Pi/4/Sin[(2*p-1)*Pi+Pi/4]^2)-1]]},{y,(2*p-1)*Pi+Pi/4}] > , {p, 1, 20, 1}] > > rr=SetPrecision[rr,20] > > ListPlot[{x, y} /. rr] > > r={x, y} /. rr; It hardly makes any difference how you adjust the precision after the fact. The default precision for FindRoot is 16, so you will not likely do better without changing that setting. In[30]:= Options[FindRoot] Out[30]= {AccuracyGoal -> Automatic, Compiled -> True, DampingFactor -> 1, > Jacobian -> Automatic, MaxIterations -> 15, WorkingPrecision -> 16} In[31]:= SetOptions[FindRoot,WorkingPrecision -> 30]; In[32]:= rr=Table[FindRoot[{x+Cos[y]*Sinh[x]==0,y+Sin[y]*Cosh[x]==0}, {x,N[Abs[Cos[(2*p-1)*Pi+Pi/4]]* Sqrt[((2*p-1)*Pi+Pi/4/Sin[(2*p-1)*Pi+Pi/4]^2)-1]]}, {y,(2*p-1)*Pi+Pi/4}], {p, 1, 20, 1}; Out[33]//InputForm= {{x -> 2.25072861160186054284001503083520723844813`30, y -> 4.21239223049066060098377055496713865116598`30}, {x -> 3.10314874582524964503110475699404628457896`30, y -> 10.71253739727926042036234315951288791861153`30}, {x -> 3.5510873470220803226254148530864263118646`30, y -> 17.0733648531518286206039048198941667635767`30}, {x -> 3.85880899310557448453230795282097650911534`30, y -> 23.3983552256513087698450247785949380606154`30}, {x -> 4.09370492476533402325023258994376256670447`30, y -> 29.7081198252760402344886104318591215923501`30}, {x -> 4.28378158777502361947594795178005263715643`30, y -> 36.0098660163716052287817970272715122428287`30}, {x -> 4.44344583032426980710004282136897176173321`30, y -> 42.3068267176393587835158655733289828573722`30}, {x -> 4.58110457345343728402400683818592881802334`30, .... Daniel Lichtblau Wolfram Research danl at wolfram.com