2

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.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
vapor
  • 7,911
  • 2
  • 22
  • 55
  • 2
    Plot[Integrate[x, x] /. x -> u, {u, -5, 5}]. You can't Integrate on a variable that has been assigned a value. – Dr. belisarius Feb 24 '15 at 11:59
  • @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? – vapor Feb 24 '15 at 12:07
  • 3
    Compare with Plot[Evaluate@Integrate[x, x], {x, -5, 5}] – Dr. belisarius Feb 24 '15 at 12:18
  • 2
    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 – Dr. belisarius Feb 24 '15 at 13:36
  • @Dr.belisarius I came across this question today, and I realized at that time I wasn't aware of the HoldAll attributes of Plot. – vapor Apr 17 '16 at 08:52

0 Answers0