Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. 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

I recently coded a program that can estimate a line integral with respect to arc length.
For example:

$$\int_Cf(x, y) dS$$

Where C is represented by the parametric equations x(t) and y(t), a ≤ t ≤ b. To estimate this, I started by creating the variable $\delta = \frac {b-a}{n}$ where n is a large number. I then made the sum (from t=a to t=b by the increment of $\delta$) by averaging two consecutive points of f(x, y) along the path C using $\delta$ as the increment to find the "height" of the rectangle and multiplied it by the "base", which I found using $\sqrt{(x(t)-x(t+\delta))^2*(y(t)-y(t+\delta))^2}$.

Is it possible to estimate line integrals like this with a modified version of Simpson's Rule?

share|cite|improve this question
Why not just write the line integral as a (regular) integral in terms of the parameterization and use Simpson's rule on that? – David Mitra Apr 1 '12 at 0:36
I would have some trouble handling the derivatives. It may be possible though, thanks. – Argon Apr 1 '12 at 0:40
@Argon : You want to estimate an integral, the fact that it is a line integral or a non-line integral doesn't matter ; once you know that the number you want to estimate is a number, the rest is just technique ; as long as you know theoretically that it'll converge, the background behind the number doesn't matter if you can approximate successfully enough. – Patrick Da Silva Apr 1 '12 at 0:48
up vote 1 down vote accepted

It looks to me that dealing with $f^\prime(t)$ and $g^\prime(t)$ when you're unable or unwilling to compute analytic derivatives is what's giving you trouble; there are a number of numerical differentiation methods you can use along with Simpson's rule (but methinks you really should be using Gaussian quadrature instead). On the other hand, there is a simple strategem due to J.C. Nash for estimating derivatives, based on the central difference approximation


The trick here is to choose $h$ to be small, but not too small; Nash's suggestion is to use $h=\sqrt{\varepsilon}\left(|x|+\sqrt{\varepsilon}\right)$ where $\varepsilon$ is machine epsilon. This should be good enough for most purposes.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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