Re: Coaxing N[] to work
- To: mathgroup at smc.vnet.net
- Subject: [mg73398] Re: [mg73370] Coaxing N[] to work
- From: "Igor C. Antonio" <igora at wolf-ram.com>
- Date: Thu, 15 Feb 2007 05:03:50 -0500 (EST)
- Organization: Wolfram Research, Inc.
- References: <200702141020.FAA19038@smc.vnet.net>
- Reply-to: igora at wolf-ram.com
p at dirac.org wrote:
> Sometimes N[,] doesn't appear to work. Like here:
>
>
> x = {2.0, 3.0, 5.0};
> A = { {6.0, 2.0, 1.0}, {2.0, 3.0, 1.0}, {1.0, 1.0, 1.0} };
> For[ k=0, k<15, ++k,
> lambda = x.A.x/(x.x);
> y = LinearSolve[A,x];
> x = y / Norm[y,Infinity];
> ]
> N[lambda, 30]
>
>
> The output is:
>
> Out[5]= 0.578933
>
> I was expecting 30 digits. Why did N[] ignore my request for 30 digits?
PLEASE read the documentation before posting to the newsgroup. The very first
line of the docs for N[] says:
"Unless numbers in expr are exact, or of sufficiently high precision, N[expr, n]
may not be able to give results with nâ??digit precision."
In[1]:=
x={2/10,3/10,5/10};
A={{6/10,2/10,1/10},{2/10,3/10,1/10},{1/10,1/10,1/10}};
For[k=0,k<15,++k,lambda=x.A.x/(x.x);
y=LinearSolve[A,x];
x=y/Norm[y,Infinity];]
N[lambda,30]
Out[4]=
0.0578933385691052787623495851172
--
Igor C. Antonio
Wolfram Research, Inc.
http://www.wolfram.com
To email me personally, remove the dash.
- References:
- Coaxing N[] to work
- From: <p@dirac.org>
- Coaxing N[] to work