I'm trying to understand the Map and Apply notation and ran into a problem.
I define this function:
f23 = Function[x, x^2];
Map[f23, {1, 2, 4, 6, 5, 8}]
and correctly get
{1, 4, 16, 36, 25, 64}
or
f23[{1, 4, 16, 36, 25, 64}]
yields
{1, 4, 16, 36, 25, 64}
but if I use Apply
Apply[f23, {12, 2, 4, 6, 5, 8}]
I only get
144
the first element. If I try using @@ it behaves just as Apply as expected.
So if I understand why apply is only operating on the first element, I can perhaps continue to learn how to use @@
Update: f23@{12, 2, 4, 6, 5, 8}
gets me
{144, 4, 16, 36, 25, 64}
So it appears I don't understand the apply @@ function
Apply, your function is defined to care about the first argument only. Confusing part is thatx^2threads over lists that is whyf23[{..}]returns a list. You canTraceto check. – Kuba Jun 17 '17 at 06:26Function, (Function[{u, v}, u^2 + v^4]), thenSetDelayed,Listableetc. – Kuba Jun 17 '17 at 06:57