MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Coaxing N[] to work

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73381] Re: [mg73370] Coaxing N[] to work
  • From: bsyehuda at gmail.com
  • Date: Thu, 15 Feb 2007 04:54:33 -0500 (EST)

FullForm[lambda] will reveal more digits, but in general, your example works
with machine precision numbers, and this depends on your machine
One possibility is to set the precision of the numbers, that is 1.0`30 (30
digits precision)
or to work with infinite precision, that is, integers and rationals, with no
decimal point
for the second case
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];]
N[lambda, 30]

returns
0.578933385691052787623495851172
regards
yehuda

On 2/14/07, p at dirac.org <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?
>
>


  • Prev by Date: Re: Comments in the front end
  • Next by Date: Re: Coaxing N[] to work
  • Previous by thread: Re: Coaxing N[] to work
  • Next by thread: Re: Coaxing N[] to work