|
[Date Index]
[Thread Index]
[Author Index]
Re: Understanding Flatten
- To: mathgroup at smc.vnet.net
- Subject: [mg46324] Re: [mg46314] Understanding Flatten
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sat, 14 Feb 2004 04:37:59 -0500 (EST)
- References: <200402140258.VAA08621@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 14 Feb 2004, at 03:58, Harold Noffke wrote:
> Mathematica 5.0.1 on Windows 2000
> MathGroup:
>
> In my study of Flatten, the Mathematica Book gives this example ...
>
> You can use Flatten to "splice" sequences of elements into lists
> or other expressions.
>
> In[5]:= Flatten[ {a, f[b, c], f[a, b, d]}, 1, f ]
>
> Out[5]= {a,b,c,a,b,d}
>
> I modified In[5] as follows ...
>
> In[1]:= Flatten[ { {a, f[b, c], f[a, b, d]}, {g, f[e, g]} }]
>
> Out[1]= {a, f[b, c], f[a, b, d], g, f[e, g]}
>
> I don't see why adding {g, f[e, g]} as a second list to the In[5]
> example
> unflattens Flatten's answer. What am I misunderstanding?
>
> Thanks.
> Harold
>
>
The two examples are quite different. In the first you are using the
form
Flatten[expr,1, f]
which falttens to level 1 all subexpresions (on level 1) with Head f .
In your second case you are using just
Flatten[expr].
To see both together:
Flatten[Flatten[{{a,f[b,c],f[a,b,d]},{g,f[e,g]}}],1,f]
{a,b,c,a,b,d,g,e,g}
Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/
Prev by Date:
Re: Re: how to explain this weird effect? Integrate
Next by Date:
Re: question: How to get Mathematica to show more than one value of a complex valued function?
Previous by thread:
Understanding Flatten
Next by thread:
Re: Understanding Flatten
|