0
$\begingroup$

There is something I don't understand with the notion of levels with apply.

I take this example :

Apply[f, {{a, b, c}, {d, e}}, {2}]

Mathematica answers me :

{{a, b, c}, {d, e}}

But for me it should answer me :

{f[a],f[b],f[c],f[d],f[e]}

As I go to the "2" level in my list which is constituted of thoose numbers.

For example at level 1, I get :

{f[a, b, c], f[d, e]}

Which I understand because the two elements of level 1 are : {a, b, c} and {d,e}

Where is my mistake ?

$\endgroup$
2
  • $\begingroup$ I think you want Map rather than Apply. I am going to mark this question as a duplicate. Please see the links that will be added at the top of your question. If you feel these do not answer your question please edit your question to explain this. $\endgroup$
    – Mr.Wizard
    May 18, 2017 at 16:14
  • $\begingroup$ You are Applying f to a, b etc. See what you get when you do f @@ a. It is not the same as f @ a. $\endgroup$ May 18, 2017 at 18:33

0

Browse other questions tagged or ask your own question.