Re: Re: (2/3)[[1]]
- To: mathgroup at smc.vnet.net
- Subject: [mg96474] Re: [mg96407] Re: (2/3)[[1]]
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Sat, 14 Feb 2009 03:10:32 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <gn11e8$7vn$1@smc.vnet.net> <200902130841.DAA26517@smc.vnet.net>
- Reply-to: murray at math.umass.edu
Although one cannot argue with the definitive answer that the Mathematica interpreter gives to such questions, I've never been satisfied with the rationale offered for this situation. After all, it's not just the way that Rational[2,3] prints (as an actual fraction) that confuses. Rather, it's the very internal form Rational[2,3] that confuses. Indeed: FullForm[ Rational[2,3] ] Rational[2,3] This looks like an expression of the form f[x,y]. And one has: part[f[x,y], 1] x Further, in the documentation page for Part, there is no explicit statement that something for which AtomQ returns True does not have parts. Still Further, the documentation for AtomQ says that AtomQ[expr] yields True if expr is an expression which cannot be divided into subexpressions; it's only under the More Information for AtomQ that one finds, "AtomQ gives True for symbols, numbers...." The situation begs for clarification! David Bailey wrote: > 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]] >> >> Thanks. >> > Internally, Mathematica considers rational numbers to be atomic objects > - they only print in a way that makes them look otherwise. You will find > that Complex[2,3] behaves in the same way for the same reason. > > David Bailey > http://www.dbaileyconsultancy.co.uk > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- Re: (2/3)[[1]]
- From: David Bailey <dave@removedbailey.co.uk>
- Re: (2/3)[[1]]