Re: (2/3)[[1]]

• To: mathgroup at smc.vnet.net
• Subject: [mg96402] Re: (2/3)[[1]]
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Fri, 13 Feb 2009 03:40:05 -0500 (EST)
• Organization: The Open University, Milton Keynes, UK
• References: <gn11e8\$7vn\$1@smc.vnet.net>

```In article <gn11e8\$7vn\$1 at smc.vnet.net>, obott0 at gmail.com wrote:

> I'm not sure if this has been asked before, but why can't Part be used
> with Rational?
>
> i.e. (2/3)[[1]]

Because even if rational numbers look like non-atomic expressions (see,
for instance, their full or tree forms), they are deemed by Mathematica
as *atomic* expressions (test with *AtomQ[]*).

In[1]:= (2/3)[[1]]

During evaluation of In[1]:= Part::partd: Part specification (2/3)[[1]]
is longer than depth of object. >>

Out[1]=
2
(-)[[1]]
3

In[2]:= FullForm[2/3]

Out[2]//FullForm= Rational[2, 3]

In[3]:= %[[1]]

During evaluation of In[3]:= Part::partd: Part specification (2/3)[[1]]
is longer than depth of object. >>

Out[3]=
2
(-)[[1]]
3

In[4]:= TreeForm[2/3]

Out[4]//TreeForm= -Graphics-

In[5]:= AtomQ[2/3]

Out[5]= True

Regards,
--Jean-Marc

```

• Prev by Date: Re: switching axes in Plot?
• Next by Date: Re: Definition of the similarity in a set of integers
• Previous by thread: Re: (2/3)[[1]]
• Next by thread: copy/paste of exponents