MathGroup Archive 2009

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

Search the Archive

Re: What is "Depth of Atomic Objects" ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96736] Re: What is "Depth of Atomic Objects" ?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Mon, 23 Feb 2009 05:02:33 -0500 (EST)

On 2/21/09 at 7:38 PM, mune9518 at gmail.com (ichi) wrote:

>Hi, The Mathematica Help in A.1.4 says "Atomic objects in
>Mathematica are considered to have depth 0 and yield True when
>tested with AtomQ." For example, numeric 4 is Integer and must be a
>Atomic object. Then I try the function Depth and AtomQ ; Depth[4]
>returns depth "1". And AtomQ[4] returns "True". Why can the function
>Depth return depth "0" ? I wonder if meaning of the function "Depth"
>differs from the word "depth". But I feel somthing strange. How can
>I understand this ?

There seems to be an inconsistency in the documentation. The
documentation for Depth under more information states:

Raw objects have depth 1.

That would seem to preclude any object in Mathematica from
having depth 0. It would seem the only way to remove the
inconsistency would be to say raw objects are different than
atomic objects. But the documentation for AtomQ under more
information states:

AtomQ gives True for symbols, numbers, strings and other raw
objects, such as sparse arrays.

and

AtomQ gives True for any object whose subparts cannot be
accessed using functions like Map.

Checking:

In[10]:= s =
  SparseArray[{{1, 1} -> 1, {2, 2} -> 2, {3, 3} -> 3, {1, 3} -> 4}]

Out[10]= SparseArray[<4>,{3,3}]

In[11]:= AtomQ[s]

Out[11]= True

But,

In[12]:=Depth[s]

Out[12]=3

In[13]:=Total /@ s

Out[13]={5, 2, 3}

which seems to contradict the documentation noted above.



  • Prev by Date: Re: ListVectorPlot3D with VectorPoints->All
  • Next by Date: Re: no message from Minimize[] on a weird function(x^x)
  • Previous by thread: What is "Depth of Atomic Objects" ?
  • Next by thread: Re: What is "Depth of Atomic Objects" ?