| Author |
Comment/Response |
Nasser M. Abbasi
|
11/15/12 6:21pm
when you see Root[-1 - #1 - 2 #1^2 + #1^3 &, 1], you can think of it as the same thing as:
--------------
k = 1; (*which root to pick *)
Root[-1 - #1 - 2 #1^2 + #1^3 &, k]
N[%]
2.54682
--------------------
which is the same as solving the polynomial in 'x'
f[x_] := -1 - x - 2 x^2 + x^3;
N[x /. Solve[f[x] == 0, x][[k]]]
2.54682
------------------------
Where I replaced the slot '#1' by an nicer looking symbol 'x'. Pure functions are core thing in Mathematica since it is a functional programming language.
URL: , |
|