Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I have problem to draw in Mathematica a plot like this:

Plot[{Sum[a^10*(-1)^(x-a), {a, 1, x}]}, {x, 1, 10}]

The problem is that on the plot there is no graph. As it can be calculated, there should be some values plotted. When I try to draw this equation in Mathematica as

plot (sum(a^10*(-1)^(x-a),a=1 to x)), x = 1 to 10 

everything works fine, so I think I did something wrong with the first command in Mathematica, but I can't find the mistake.

share|improve this question

marked as duplicate by R. M. Dec 5 '13 at 8:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The same question on StackExchange: "Plot with sum commend." – Alexey Popkov Dec 5 '13 at 6:45
up vote 5 down vote accepted

Plot has attributes, HoldAll, so the Sum isn't evaluated,

try this:

Plot[Evaluate[Sum[a^10*(-1)^(x - a), {a, 1, x}]], {x, 1, 10}]

Where the sum evaluates to:

Mathematica graphics

before plotting:

enter image description here

related questions/answers:

Difference in Plot when using Evaluate vs when not using Evaluate

How and when to use Evaluate?

Behavior of expression evaluation in Plot

I prefer a different domain:

Plot[Evaluate[Sum[a^10*(-1)^(x - a), {a, 1, x}]], {x, -3, 2}]

Mathematica graphics

share|improve this answer
Yeah, that's it – Dr. belisarius Dec 5 '13 at 3:34
@s0rce I have one more problem when i Want to draw this: Plot[Evaluate[Sum[Binomial[x, l]*l^10*(-1)^(x - l), {l, 0, x}]], {x, 1,2}], no graph is plotted, and I can't notice way, because if I will calucate this, there should be some points – Ziva Dec 6 '13 at 0:35
@Ziva the result of your sum seems to be only defined for integers. – s0rce Dec 6 '13 at 4:35
@sOrce, Yes, you are right! I forgot to restrict x to integers. – Ziva Dec 6 '13 at 10:25

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