Here is another problem. In the following f is an expression with r and p.
f[r_]:=0.8 - 0.0009375/r^6 + 0.25/r^2 - 20/r + 8/3 P \[Pi] r^2
Now if I Solve for f(r)=0 with fixed P, This gives a real solution.
Last[Solve[f[r] == 0 /. {Q -> 0.5, P -> 1, M -> 10}, r, Reals]]
This gives a solution. But when I am solving f(r)=0 first and then put the value of P, I am getting no answer. I used
rh2 = r /. Last[Solve[f[r] == 0 /. {Q -> 0.5, M -> 10}, r, Reals]];
rh2 /. P -> 1
This is showing undefined. Why is it happening and how to overcome this problem?