[Date Index]
[Thread Index]
[Author Index]
Re: Question
*To*: mathgroup at smc.vnet.net
*Subject*: [mg74801] Re: Question
*From*: dh <dh at metrohm.ch>
*Date*: Thu, 5 Apr 2007 04:17:59 -0400 (EDT)
*References*: <euvn8c$f64$1@smc.vnet.net>
Hi Peter,
I think the following somewhat confusing sentence from the Help can
explain your problem:"When expr is a list, expr[[ {a, a, ? } ]] gives a
list of parts. In general, the head of expr is applied to the list of
parts". I interprete this as: if the expression is not a list, then,
after creating the list of parts, the Head of the expression is applied
to the List of parts. From this it follows that Ë[[{1, 2, 3}]] is the
same as Ë. With Ë[[{1, 2, 3}, 1]], first a list of the first parts of
the first level parts is created and then the Head of List is changed to
the Head of Ë, that is ë0.
Daniel
Peter van Summeren wrote:
> Hello,
> I read in the book about programming from Michael Trott:
> Ë = ë0[ë1[ë2[ë3[1, 1, 1], ë3[1, 1, 2], ë3[1, 1, 3]],
> ë2[ë3[1, 2, 1], ë3[1, 2, 2], ë3[1, 2, 3]],
> ë2[ë3[1, 3, 1], ë3[1, 3, 2], ë3[1, 3, 3]]],
> ë1[ë2[ë3[2, 1, 1], ë3[2, 1, 2], ë3[2, 1, 3]],
> ë2[ë3[2, 2, 1], ë3[2, 2, 2], ë3[2, 2, 3]],
> ë2[ë3[2, 3, 1], ë3[2, 3, 2], ë3[2, 3, 3]]],
> ë1[ë2[ë3[3, 1, 1], ë3[3, 1, 2], ë3[3, 1, 3]],
> ë2[ë3[3, 2, 1], ë3[3, 2, 2], ë3[3, 2, 3]],
> ë2[ë3[3, 1, 3], ë3[3, 2, 3], ë3[3, 3, 3]]]];
> I do: TreeForm[Ë[[{1, 2, 3}]]] === TreeForm[Ë]
> and it gives: True
> Now comes my question:
> TreeForm[Ë[[{1, 2, 3}]][[1]]] is different from TreeForm[Ë[[{1, 2, 3}, 1]]]
>
> Why does the second expression preserve the head? Which rationale?
> My first grasp tells me that it should not.
> with friendly greetings,
> Peter
>
Prev by Date:
**Re: Integral of Piecewise function involving DiracDelta**
Next by Date:
**Re: Depurating tool**
Previous by thread:
**Re: label graph vertices**
Next by thread:
**Re: Question**
| |