0
$\begingroup$

I tried this:

ContourPlot[(4-d^b==0)/.b->1/t, {t,0,1},{d,0,4}]

However, nothing is plotted. This works fine instead:

ContourPlot[4-d^(1/t)==0, {t,0,1},{d,0,4}]

Why is that? How should I use the first code to plot the equation?

$\endgroup$
2
  • $\begingroup$ ContourPlot[ Evaluate[(4 - d^b == 0) /. b -> 1/t], {t, 0, 1}, {d, 0, 4}] would work with the same General message. $\endgroup$
    – Syed
    May 17, 2023 at 18:31
  • $\begingroup$ Alternatively, use With[{b = 1/t}, ContourPlot[(4 - d^b == 0), {t, 0, 1}, {d, 0, 4}]] $\endgroup$
    – Bob Hanlon
    May 17, 2023 at 19:13

1 Answer 1

1
$\begingroup$

Look at:

Attributes[ContourPlot]

{HoldAll, Protected, ReadProtected}

The attribute "HoldAll" prevents the replacement to be executed before calling ContourPlot. To force the execution, use "Evaluate" like:

ContourPlot[
 Evaluate[(4 - d^b == 0) /. b -> 1/t], {t, 0, 1}, {d, 0, 4}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.