I am looking to simply take out the numeric parts of the solutions to a simple equation, i.e.
Roots[-z^4 + 6 z^2 - 1 == 0, z]
Gives
{z == -1 - Sqrt[2] || z == -1 + Sqrt[2] || z == 1 - Sqrt[2] || z ==
> 1 + Sqrt[2]}
But what I would really like is:
{-1 - Sqrt[2] ||-1 + Sqrt[2] || 1 - Sqrt[2] || 1 + Sqrt[2]}
so that way I can do something like this:
Sols = Roots[-z^4 + 6 z^2 - 1 == 0, z]
For[i = 0, i <= Length[Sols], i++,
Residue[4 z/(-z^4 + 6 z^2 - 1), {z, Sols[[i]]}]]
But, as of current, this will not evaluate since Mathematica doesn't know how to make sense of z == -1+$\sqrt2$ in the For loop, whereas it would be able to make sense of -1+$\sqrt2$ in the For loop.
My attempt at solving this problem was to brute force remove the "z==" stuff, but that doesn't seem to be working. This is the bit of code I wrote to do that:
For[i = 0, i <= Length[Sols], i++,
ReplacePart[Sols, i -> StringTrim[Sols[[i]], "z \[Equal]" ]]]
But clearly this won't work since Sols[[i]] is not a string. But I feel like something like this ought to exist. After all, finding solutions is only cool when you see what they do. Is there any way to do what I'm doing in a better way? Or is there some way to remove the "variable part" of the solution set?
{Map[Last, Roots[-z^4 + 6 z^2 - 1 == 0, z]]}
$\endgroup$fz = z/(-z^4 + 6 z^2 - 1); Table[Residue[fz, {z, res}], {res, z /. Solve[Denominator[fz] == 0, z]}]
. ReplaceTable[]
withSum[]
if you're doing contour integration. $\endgroup$Roots[-z^4 + 6 z^2 - 1 == 0, z] /. Equal[a_, b_] :> b
. $\endgroup$