I’m sure this is very simple, but I ask Mathematica for the characteristic polynomial of an equation, as follows:
m={
{0, n, 0, c1},
{R, 0, 4, c2},
{0, R, 0, 0},
{0, 0, R, c4}
}
CharacteristicPolynomial[m,x]
Now, I would like to save the returned polynomial as a function, so I can later call it (presumably with something like f[1]). Alas, I’ve been unable to figure out how to do this.
This is fairly straightforward. Simply do this
Note the use of
Set(=) notSetDelayed(:=) which forcesCharacteristicPolynomialto be evaluated once. If you usedSetDelayed, then it would be evaluated every timefis evaluated.