1
$\begingroup$

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?

  • 0
    @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}$?2018-11-12

1 Answers 1

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.