1

I'd like to plot a few curves in a plot but with different colors, like in this code :

f[x_, a_] = x*Log[x] + (1 - x)*Log[1 - x] - a*x^2 ;
Plot[Table[f[x, a], {a, {0, 1, 2, 3, 4, 5, 6, 7}}], {x, 0.0001, 0.9999}]

But I'm getting all of them in blue !

plot

What can I do ?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
J.A
  • 1,265
  • 5
  • 14

1 Answers1

4

One possible way

 f[x_,a_]=x*Log[x]+(1-x)*Log[1-x]-a*x^2;
 Plot[Evaluate@Table[f[x, a], {a, {0, 1, 2, 3, 4, 5, 6, 7}}], {x, 0.0001, 0.9999}]

Mathematica graphics

I would also consider changing your definition from f[x_,a_]=x*Log[x]+(1-x)*Log[1-x]-a*x^2; to f[x_,a_]:=x*Log[x]+(1-x)*Log[1-x]-a*x^2;

Nasser
  • 143,286
  • 11
  • 154
  • 359