toolgre.blogg.se

Mathematica if
Mathematica if









mathematica if

Reveals that what is actually going on is Function,2]]. The Slot is treated as the argument in an anonymous function. While the tutorial will undoubtedly explain better that I could the entire topic of pure functions, which is what Slot, or # has to do with, I'll answer the specific question at hand. I'll save you from an explanation about radicals and finding polynomial roots. So, Root is a kind of stenographic writing for roots of polynomials with order > 3. It's just the first root of the polynomial. That means Mathematica doesn't know how to calculate a symbolic result for the root. So, if your polynomial is $x^2 - 1$, using what we saw above: f = #^2 - 1 &īut if we try with a higher order polynomial: f = -1 - 2 #1 - #1^2 + 2 #1^3 + #1^4 & Root represents the exact kth root of the polynomial equation f=0. Or you may have a function operating on a list, like: f = #] + #] & If you have a function operating on two variables, you could do: f = #1 + #2 & That is important for pairing & and # when you have nested functions. The & "pumps in" the expression into the # sign. If you want to define a function, $y(x)=x^2$, you just could do: f = #^2 &











Mathematica if