(I wasn't sure what to put for the title, so feel free to improve it if you can think of a better one.)

How do I evaluate an integral that contains an unknown function of the integration variable such as the following in Mathematica?

$$\int_{x_1}^{x_2} \frac{dy}{dx} dx$$

It should obviously give me back $y(x_2) - y(x_1)$.

  • $\begingroup$ What answer are you hoping to get? $\endgroup$ – evanb Dec 9 '14 at 21:53
  • $\begingroup$ Aren't you integrating the derivative of the arc-length? $\endgroup$ – Dr. belisarius Dec 9 '14 at 21:53
  • $\begingroup$ That's what it looks like to me. But it's not quite. There ought to be a chain-rule d^2y / dx^2 in the numerator if it were truly the arclength, unless I'm mistaken. $\endgroup$ – evanb Dec 9 '14 at 22:11
  • $\begingroup$ @evanb: Whoops, I typed in the wrong expression... my bad. But for the purposes of this question ignore the actual expression, I'm just trying to learn how to use Mathematica to do an implicit integral. I've changed it to something trivial now. $\endgroup$ – user541686 Dec 9 '14 at 22:37
  • 1
    $\begingroup$ Oops, as I typed up my answer I got the sneaking feeling I've done this before: mathematica.stackexchange.com/questions/66494/… $\endgroup$ – Michael E2 Dec 9 '14 at 22:50

How about this?

f[x2] /. First @ DSolve[{f'[x] == y'[x], f[x1] == 0}, f, x]
  -y[x1] + y[x2]
| improve this answer | |

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