Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: question on changing 'type' of numbers

  • To: mathgroup at
  • Subject: [mg69508] Re: [mg69473] question on changing 'type' of numbers
  • From: Sseziwa Mukasa <mukasa at>
  • Date: Thu, 14 Sep 2006 06:56:27 -0400 (EDT)
  • References: <>

On Sep 13, 2006, at 4:03 AM, Nasser Abbasi wrote:

> I think of a the Head of expression as its 'type'.
> One is supposed to be able to use Apply[f,expr] to change head of  
> expression
> to f.
> But Why can't I use this to change the head of a Real number to  
> Integer?

Because Reals and Integers are atoms, you can't change the head of an  

> In[122]:=
> Remove["Global`*"]
> x = 0.1
> Head[x]
>            -------------->Real
> Apply[Integer,x]
> Head[x]
>         ------------------->Real. I was expecting Intger
> x = Integer[x]
> Head[x]
>       ----------------> Now it says Integer

It says Integer, but it's not an integer in the same sense that 9 is  
an integer.  Integer[x] is an expression with the head Integer, which  
is a symbol, and body x, 9 is an expression with the head Integer and  
no body, you can take Integer[x] apart eg.


You cannot take 9 apart because it is an atom.

> Now sure what the above really means :)

Hope this helps,


  • Prev by Date: Re: Derivative of a function with multiple variables
  • Next by Date: partials of Sum[x[i]^2, {i,1,n}] (e.g.)
  • Previous by thread: question on changing 'type' of numbers
  • Next by thread: Re: question on changing 'type' of numbers