Function plotting in Mathematica [closed]

I want to plot following function in Mathematica:

$f(x) = \frac{x}{x+c}$

I used the following command.

ListPlot[x/(x+c), {c, 1,10}, {x, 0, 10, 0.1}]


But it does not give me legends like which plot belongs to which value of c. Need help ASAP.

closed as off-topic by Sascha, Sjoerd C. de Vries, Bob Hanlon, happy fish, J. M. is away♦Apr 23 '17 at 12:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Sascha, Sjoerd C. de Vries, Bob Hanlon, happy fish, J. M. is away
If this question can be reworded to fit the rules in the help center, please edit the question.

• Use Plot3D[x/(x+c),{c,1,10},{x,0,10}] or if you want to plot your function multiple times for different c, use Plot[Evaluate@Table[x/(x+c),{c,1,10}],{x,0,10}] – Julien Kluge Apr 23 '17 at 10:26
• @JulienKluge: What i wrote does the trick but I want mathematica to show me which plot corresponds to which value of c. – Monty Apr 23 '17 at 10:37
• See my answer. And no, your given code isn't even valid MMA code. – Julien Kluge Apr 23 '17 at 10:40

1 Answer

You should really use Plot

Plot[Evaluate@Table[x/(x+c),{c,1,10}],{x,0,10},PlotLegends->"Expressions"]


evaluates to:

Explanation:

1.

Table[x/(x+c),{c,1,10}]


Evaluates to your functions, for the given Range of c.

{x/(1+x),x/(2+x),x/(3+x),x/(4+x),x/(5+x),x/(6+x),x/(7+x),x/(8+x),x/(9+x),x/(10+x)}

2.

Evaluate@Table[...


Evaluate forces Mathematica to evaluate the Table-expression. This must be done, because Plot holds its arguments. See here.

3.

PlotLegends->"Expressions"


Is an option for Plot and says Mathematica, that it should use the function-expressions as PlotLegends.