Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does # mean in Mathematica?

Does anyone know What # in for example Root[-1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 &, 1] means in Mathematica?

Then what does Root[-1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 &, 1] exactly mean?

Thanks.

like image 510
user376089 Avatar asked Nov 24 '10 22:11

user376089


People also ask

What does the fox say Meaning?

Speaking of the meaning of the song, Vegard characterizes it as coming from "a genuine wonder of what the fox says, because we didn't know". Although interpreted by some commentators as a reference to the furry fandom, the brothers have stated they did not know about its existence when producing "The Fox".

How can I find a song by the sound?

On your phone, touch and hold the Home button or say "Hey Google." Ask "What's this song?" Play a song or hum, whistle, or sing the melody of a song. Hum, whistle, or sing: Google Assistant will identify potential matches for the song.

What does the fox say for real?

One of the most common fox vocalizations is a raspy bark. Scientists believe foxes use this barking sound to identify themselves and communicate with other foxes. Another eerie fox vocalization is a type of high-pitched howl that's almost like a scream.


2 Answers

It's a placeholder for a variable.

If you want to define a y(x)=x^2 function, you just could do:

  f = #^2 & 

The & "pumps in" the variable into the # sign. That is important for pairing & and # when you have nested functions.

  In: f[2]  
  Out: 4   

If you have a function operating on two vars, you could do:

 f = #1 + #2 &

So

  In: f[3,4]  
  Out: 7  

Or you may have a function operating in a list, so:

 f = #[[1]] + #[[2]] &

So:

  In: f[{3,4}]
  Out: 7

About Root[]

According to Mathematica help:

Root[f,k] represents the exact kth root of the polynomial equation f[x]==0  .

So, if your poly is x^2 - 1, using what we saw above:

        f = #^2 - 1 &

In[4]:= Root[f, 1]  

Out[4]= -1  (* as we expected ! *)

And

In[5]:= Root[f, 2]  

Out[5]= 1  (* Thanks God ! *)

But if we try with a higher order polynomial:

         f = -1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 &  

In[6]:= Root[f, 1]

Out[6]= Root[-1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 &, 1]

That means Mathematica doesn't know how to caculate a symbolic result. It's just the first root of the polynomial. But it does know what is its numerical value:

In[7]:= N@Root[-1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 &, 1]

Out[7]= -2.13224

So, Root[f,k] is a kind of stenographic writing for roots of polynomials with order > 3. I save you from an explanation about radicals and finding polynomial roots ... for the better, I think

like image 51
Dr. belisarius Avatar answered Sep 30 '22 00:09

Dr. belisarius


How to find out what any built-in syntax means in Mathematica:

  1. Copy expression
  2. Do TreeForm[Hold[paste the expression here]].
  3. Mouse-over parts of the tree to identify the syntax in question, in this case Slot
  4. Enter "?Slot"
like image 26
Yaroslav Bulatov Avatar answered Sep 30 '22 01:09

Yaroslav Bulatov