MathGroup Archive 2001

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

Search the Archive

Re: Letting integers be integers (when using //N)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27659] Re: Letting integers be integers (when using //N)
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 10 Mar 2001 00:49:48 -0500 (EST)
  • References: <98a14b$cl3@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Here is the seventh Fibonacci number - an integer.

fb7=(#^7 -(-#^-7))/Sqrt[5]&[(1 + Sqrt[5])/2];

Test the following

({Sqrt[2],fb7,a}//N) /. (x_/;(Round[x]==x)) -> Round[x]

        {1.41421,13,a}

--
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

"A. E. Siegman" <siegman at stanford.edu> wrote in message
news:98a14b$cl3 at smc.vnet.net...
> A convenient way to format and print the numerical values of a bunch of
> variables a,b,c, . . . neatly aligned directly under their corresponding
> names is
>
>      Print[ { {"a", "b", "c", . . . .},
>                  {a,  b,  c, . . . . . } file://N } file://TableForm]
>
> The file://N is needed for most of the variables in the list, because most
of
> them will otherwise appear as messy expressions with lots of pi's and
> Sqrt[2]'s and such.
>
> The thing is, the variable  a  has an inherently integer value, and just
> being fussy I'd like it to print as an integer.  But if I write the
> second list as
>
>                 {Round[a], b, c, . . . .}//N
>
> the  a  value still comes out with a decimal point.  Any simple way to
> get rid of the decimal point on that one value, other than putting
file://N
> on each item of the list individually except for  a ?
>




  • Prev by Date: RE: Letting integers be integers (when using //N)
  • Next by Date: Thesis
  • Previous by thread: RE: Letting integers be integers (when using //N)
  • Next by thread: Re: Letting integers be integers (when using //N)