# Removing variable characters from set of solutions

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?

• Try {Map[Last, Roots[-z^4 + 6 z^2 - 1 == 0, z]]}
– user46676
Apr 5, 2017 at 1:35
• You're working too hard: fz = z/(-z^4 + 6 z^2 - 1); Table[Residue[fz, {z, res}], {res, z /. Solve[Denominator[fz] == 0, z]}]. Replace Table[] with Sum[] if you're doing contour integration. Apr 5, 2017 at 1:38
• For fun - pattern matching: Roots[-z^4 + 6 z^2 - 1 == 0, z] /. Equal[a_, b_] :> b. Apr 5, 2017 at 10:46
• @ J.M. How did you get the text to look like Mathematica code? Apr 5, 2017 at 17:16

Last /@ Roots[-z^4 + 6 z^2 - 1 == 0, z]

-1 - Sqrt[2] || -1 + Sqrt[2] || 1 - Sqrt[2] || 1 + Sqrt[2]