How to use output from previous line in Plot? [duplicate]

This question already has an answer here:

Suppose, I want to solve a equation and want to obtain it's first root. In this case I've used

In=:Solve[b^2 + b*z + 1 == 0, b][]

This gives

Out={b -> 1/2 (-z - Sqrt[-4 + z^2])}

Now I want use this result directly in Plot command. My code for this is

In:Plot[Out, {z, -1000, 1000}, PlotRange -> All]

But I'm not getting the plot. If I use

In:Plot[1/2 (-z - Sqrt[-4 + z^2]), {z, -1000, 1000}, PlotRange -> All]

I'm getting the plot correctly. I guess in In, Out contains b->, that's why it's unable to plot. How to handle this situation?

p.s. This is a prototype of my actual problem. I want to solve this in this way because my output is too large to copy and paste in the Plot command.

marked as duplicate by Ajasja, Artes, m_goldberg, Michael E2, Mr.Wizard♦May 29 '13 at 1:51

• Try Plot[%[[1, 2]], {z, -1000, 1000}, PlotRange -> All]! Taking second part of the Rule is the trick. You can also use Plot[Out[[1, 2]], {z, -1000, 1000}, PlotRange -> All]. – PlatoManiac May 28 '13 at 8:34
• @PlatoManiac. Thanks for suggestion. – Biswajit May 28 '13 at 10:46
• @PlatoManiac I would strongly advise against this suggestion (i.e., using % or Out). It makes repeating the results when you re-run your notebook dependent on the order of execution. When you are going to use the results of a calculation assign a variable to that result. – Sjoerd C. de Vries May 28 '13 at 15:24
• @SjoerdC.deVries Thx for pointing out the pitfall with Out or %. I though assumed the OP will understand this ordering issue himself while playing with the notebook and if not through the answers below. – PlatoManiac May 28 '13 at 20:40