1
$\begingroup$

I encounter this problem in Mathematica 9.0.1, I'm not sure if it ever happens in other version.

Plot[{x, x + 1}, {x, 0, 10}, PlotStyle -> {Red, Green}] 

This will show a red curve and a green curve, which is as expected.

But

Plot[{a, b} /. {a -> x, b -> x + 1}, {x, 0, 10}, PlotStyle -> {Red, Green}] 

will give me two green curves.

Since

{a, b} /. {a -> x, b -> x + 1} 

will give you

{x, 1 + x} 

, I don't understand why there is difference in the results given by the two plot statements.

$\endgroup$
2
  • $\begingroup$ mathematica.stackexchange.com/questions/11772/… $\endgroup$ Commented Mar 1, 2013 at 3:18
  • $\begingroup$ From the documentation: Plot has attribute HoldAll and evaluates f only after assigning specific numerical values to x. You need to Evaluate first. $\endgroup$ Commented Mar 1, 2013 at 3:20

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.