Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'slot notation' topicStudent Support Forum > General > "slot notation"

< Previous CommentHelp | Reply To Comment | Reply To Topic
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: ,

Subject (listing for 'slot notation')
Author Date Posted
slot notation sheila 11/15/12 04:02am
Re: slot notation Bill Simpson 11/15/12 1:15pm
Re: slot notation yehuda 11/15/12 1:55pm
Re: slot notation Michael 11/15/12 3:06pm
Re: slot notation Nasser M. Ab... 11/15/12 6:21pm
< Previous CommentHelp | Reply To Comment | Reply To Topic