Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's a placeholder for a variable. </p> <p>If you want to define a y(x)=x^2 function, you just could do:</p> <pre><code> f = #^2 &amp; </code></pre> <p>The &amp; "pumps in" the variable into the # sign. That is important for pairing &amp; and # when you have nested functions. </p> <pre><code> In: f[2] Out: 4 </code></pre> <p>If you have a function operating on two vars, you could do:</p> <pre><code> f = #1 + #2 &amp; </code></pre> <p>So </p> <pre><code> In: f[3,4] Out: 7 </code></pre> <p>Or you may have a function operating in a list, so:</p> <pre><code> f = #[[1]] + #[[2]] &amp; </code></pre> <p>So: </p> <pre><code> In: f[{3,4}] Out: 7 </code></pre> <p><b> About <code>Root[]</code></b> </p> <p>According to Mathematica help: </p> <pre><code>Root[f,k] represents the exact kth root of the polynomial equation f[x]==0 . </code></pre> <p>So, if your poly is <code>x^2 - 1</code>, using what we saw above: </p> <pre><code> f = #^2 - 1 &amp; In[4]:= Root[f, 1] Out[4]= -1 (* as we expected ! *) </code></pre> <p>And</p> <pre><code>In[5]:= Root[f, 2] Out[5]= 1 (* Thanks God ! *) </code></pre> <p>But if we try with a higher order polynomial:</p> <pre><code> f = -1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 &amp; In[6]:= Root[f, 1] Out[6]= Root[-1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 &amp;, 1] </code></pre> <p>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: </p> <pre><code>In[7]:= N@Root[-1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 &amp;, 1] Out[7]= -2.13224 </code></pre> <p>So, <code>Root[f,k]</code> 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</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload