How to transform $\int_{x_0}^x\frac{y(x)}{x}dx$ from an integral to a sum?

I need to transform this integral

$$\int_{x_0}^x\frac{y(x)}{x}dx$$

to a sum for computational purposes but it is years since I had calculus, so I have forgotten (if I even knew it in the first place) how to do it.

I am primarily interested in a numerical method to solve this problem (thank you for your comment, @Doug M).

• Are we looking for numerical methods to calculate this integral? Or are you looking for an analytical answer? If it is the former. Here are some links to the Trapezoid Rule and Simpsons rule. en.wikipedia.org/wiki/Trapezoidal_rule en.wikipedia.org/wiki/Simpson%27s_rule Aug 19, 2020 at 21:24
• I am interested in a numerical method to calculate this integral. I will update the question accordingly. Thank you for asking me to be specific, @Doug M. Aug 20, 2020 at 10:09

Hint: $$\int_{a}^{b}f(x)dx=\lim_{n\to \infty} \sum_{k=1}^{n}f(x+k\Delta x)\Delta x$$ where $$\Delta x=\frac{b-a}{n}.$$ This is the formula for representing a definite integral as the limit of a Riemann sum.

• Thank you, @Pendronator. Could you please elaborate beyond your hint? I apologize for being so thick-headed. Aug 25, 2020 at 19:09
• @naughty_waves Thank you, and there's no need to apologize :). Try setting $f(x)=\frac{y(x)}{x}.$ You can use that to convert the integral to the limit of a Riemann sum. Getting a specific answer depends on what $y(x)$ is. I agree with what user2661923 said about this method being a starting point; if this doesn't work, don't get discouraged. Stay safe. :) Aug 25, 2020 at 21:22

I completely agree with Pendronator's answer and advise the OP to use it as a starting point. Then the OP will basically have two choices:

(1) using math
(2) using a computer

..........

(1)
Based on the OP's query, this does not involve attempting to find the antiderivative. Instead, it involves setting up the summation as a function of $$n$$, and then using math to compute the limit of the summation, as $$n$$ goes to infinity.

The classic problem where this is an apt approach is
$$\int_0^1 x^2 dx.$$
Here, you would (arguably) need that
$$\sum_{i=1}^n i^2 = \frac{n (n+1) (2n+1)}{6}.$$

(2)
The classic problem where this is an apt approach is
$$\int_0^1 \frac{1}{x^2 + 1}dx.$$
In fact, the pertinent antiderivative is arctan$$(x)$$, so the exact answer is $$\pi/4.$$

However, I am assuming that the OP would want to use the computer to compute an approximate answer. If you set $$n$$ equal to the fixed value of (for example) $$n = 100,$$ set up your summation accordingly, and then use a computer to calculate the sum, you will get an answer that approaches $$\pi/4.$$

You might then repeat this trial with $$n = 1000,$$ and compare the accuracy of this approximation with that from $$n = 100.$$ This will give you a reasonable idea of how large to make $$n$$ (i.e. setting $$n$$ to some fixed large integer) in order to achieve the desired accuracy when approximating the area under the curve for your specific function $$y(x)$$, whatever that function happens to be.

• Thank you, @user2661923. Yes, I need to do it using a computer since. I am still trying to wrap my thick head around your answer. Aug 25, 2020 at 19:07
• @naughty_waves I'm assuming that your are referring to the approach that I advocate for $\int_0^1 \frac{1}{x^2 + 1}dx.$ Based on your comment, I advocate a preliminary step. Attack this specific problem 3 times, manually (i.e. with pen/paper rather than computer), just to ensure that you grasp the concept. Do it once for $n=2$, once for $n=4$, and once for $n = 6$. If you do it correctly, you should observe that the manual answers approach $\pi/4$ as $n$ goes from 2 to 4 to 6. Aug 25, 2020 at 21:04