MathGroup Archive 2000

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

Search the Archive

Re: Annoying Little Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24870] Re: Annoying Little Problem
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 19 Aug 2000 04:45:46 -0400 (EDT)
  • References: <8mdm1e$5li@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Clear[v2]
v2 = {4, 0, -6}

N[Sqrt[v2.v2], 3]

7.2111

N is concerned with output and its precision not with how the output is
displayed.
For the latter we can use NumberForm

NumberForm[N[Sqrt[v2.v2]], 3]         (*1*)

"7.21"

The output is the underlying decimal.

%

7.2111

And even this is the display of a stored number with 16 decimal places

We can see the situation  if we look at the cell expression of the output
from (*1*); which is (using Format>ShowExpression)

Cell[BoxData[
    TagBox[
      InterpretationBox["\<\"7.21\"\>",
        7.2111025509279782,
        AutoDelete->True],
      (NumberForm[ #, 3]&)]], "Output",
  CellLabel->"Out[132]//NumberForm="]

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Nalanji Dreaming" <ayrton at rac1.wam.umd.edu> wrote in message
news:8mdm1e$5li at smc.vnet.net...
> I'm having an annoying little problem with version 4.0.1.0. I wrote the
> following info in a notebook and ran it:
>
> Clear[v2]
> v2 = {4, 0, -6}
> N[Sqrt[v2.v2]]
> N[Sqrt[v2.v2], 3]
>
> Now the third line gives me 7.2111 but the fourth line gives me the
> same instead of 7.21. Does anyone have any idea what may be the problem?
> Am I doing something wrong?
>
> thanks,
> Nalanji Dreaming
>




  • Prev by Date: Re: Re: Annoying Little Problem
  • Next by Date: FindRoot with two equations
  • Previous by thread: Re: Re: Annoying Little Problem
  • Next by thread: Re: Need help defining an Octahedron