Re: Coaxing N[] to work

• To: mathgroup at smc.vnet.net
• Subject: [mg73404] Re: Coaxing N[] to work
• From: "Steven.Shippee" <slshippee at comcast.net>
• Date: Thu, 15 Feb 2007 05:07:06 -0500 (EST)
• References: <equo6r\$in0\$1@smc.vnet.net>

On Feb 14, 2:27 am, <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?

Whereas you introduced approximations in your original post/problem,
Mathematica did not see fit to compute numbers out to the degree of
precision you asked for.  If you try the following I think you get
closer to what you are trying for ...

Steven Shippee
slshippee at comcast.net

In[1]:=
x = {2, 3, 5};
A = { {6, 2, 1}, {2, 3, 1}, {1, 1, 1} };
For[k=0,k<15,++k,lambda=x.A.x/(x.x);
y=LinearSolve[A,x];
x=y/Norm[y,Infinity];]

In[4]:=
sol1=lambda

Out[4]=
\!\(1102158619423970036337\/1903774504398915184457\)

In[5]:=
N[%,30]

Out[5]=
0.578933385691052787623495851172

• Prev by Date: Re: Coaxing N[] to work
• Next by Date: Re: Coaxing N[] to work
• Previous by thread: Re: Coaxing N[] to work
• Next by thread: Re: Coaxing N[] to work