2
$\begingroup$

This should be a really simple question, but I just got confused.

Plot[Integrate[x, x], {x, -5, 5}]

Integrate::ilim: Invalid integration variable or limit(s) in -4.9998. >>
Integrate::ilim: Invalid integration variable or limit(s) in -4.79571. >>
Integrate::ilim: Invalid integration variable or limit(s) in -4.59163. >>
General::stop: Further output of Integrate::ilim will be suppressed during this calculation. >>

And it gives no graph of the function.

At first I was trying to plot a function that Mathematica is unable to integrate, but the problem exists with even simple functions.

By the way, Mathematica refuses to integrate Log[Abs[x]] while Wolfram|Alpha is able to give the result.

I apologize in advance if this is my stupid mistake.

$\endgroup$

closed as off-topic by m_goldberg, bbgodfrey, Karsten 7., Bob Hanlon, halirutan Feb 25 '15 at 23:05

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." – m_goldberg, bbgodfrey, Karsten 7., Bob Hanlon, halirutan
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ Plot[Integrate[x, x] /. x -> u, {u, -5, 5}]. You can't Integrate on a variable that has been assigned a value. $\endgroup$ – Dr. belisarius Feb 24 '15 at 11:59
  • $\begingroup$ @belisarius so you mean that Mathematica evaluates Plot first and assigns values to x. I thought it evaluates Integrate first. Thanks. by the way, where can I know about the priority of the functions being evaluated? $\endgroup$ – happy fish Feb 24 '15 at 12:07
  • 3
    $\begingroup$ Compare with Plot[Evaluate@Integrate[x, x], {x, -5, 5}] $\endgroup$ – Dr. belisarius Feb 24 '15 at 12:18
  • 2
    $\begingroup$ To closers: I would rather prefer to close this one as a dup and not as a "trivial" question. But I can't find any other question covering this specifically $\endgroup$ – Dr. belisarius Feb 24 '15 at 13:36
  • $\begingroup$ @Dr.belisarius I came across this question today, and I realized at that time I wasn't aware of the HoldAll attributes of Plot. $\endgroup$ – happy fish Apr 17 '16 at 8:52