1

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?

Argon
  • 25,303
  • 3
    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 01 '12 at 00:36
  • I would have some trouble handling the derivatives. It may be possible though, thanks. – Argon Apr 01 '12 at 00:40
  • 1
    @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 01 '12 at 00:48
  • @Argon: why is it $\sqrt{(x(t)-x(t+\delta))^2*(y(t)-y(t+\delta))^2}$ not $\sqrt{(x(t)-x(t+\delta))^2 + (y(t)-y(t+\delta))^2}$? – jjjjjj Nov 12 '18 at 19:08

1 Answers1

1

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

$$f^{\prime}(x)\approx\frac{f(x+h)-f(x-h)}{2h}$$

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.

jjjjjj
  • 2,671