# Calculate the arc length of a Steinmetz curve numerically

I'd like to know the length made by the intersection curve of two orthogonal cylinders of different radii a and b where a > b >0.

I came across this post that provides a solution with an elliptical integral:

https://math.stackexchange.com/questions/1340318/arclength-of-intersection-between-2-perpendicular-cylinders

My end goal is to create a function in excel that would look something like steinmetzcur(a,b) = arc length in inches. What numerical method would I need to use to solve the problem, and could this feasibly be done in excel?

• Are you interested in the case of integrating from $0$ to $2\pi$? Feb 24, 2021 at 1:33
• Yes. I'd like to know the entire arc length. The real world application is to determine the amount of weld metal (total linear inches) required on a radial nozzle on a pressure vessel. Feb 24, 2021 at 4:25

As the integrand (in the answer you quote) is periodic and fairly smooth, you can evaluate it numerically using the trapezoidal rule. For such integrands, the convergence is exponential, so you shouldn’t need too many points. Here is a nice explanation. I think it is quite feasible to do this in Excel.

Here's some matlab code that shows the rapid convergence (and the integrand) for the case of equal radii.

I = zeros(50, 1);
f = @(x)sqrt((1-cos(x).^4)./(1-cos(x).^2));
for i = 2:2:100
x = linspace(0, 2 * pi, i);
y = f(x);
y(1) = sqrt(2) / 2;   % f(0) = f(2*pi) = NaN, but f(0) -> sqrt(2).
y(end) = sqrt(2) / 2; % Divide by 2 for trapzeoidal rule
I(i / 2) = sum(y) * (x(2) - x(1));
end
subplot(2,1,1), plot(x, f(x)), title('Integrand'), axis tight, xlabel('$$\theta$$')
subplot(2,1,2), semilogy(2:2:100, abs(I - I(end))), title('Convergence of trapezoidal rule'), ylabel('Error')


• Thanks. It's been quite some time since I've used any numerical methods but I think I should be able to do this. Feb 24, 2021 at 15:33
• I was able to use the trapezoidal rule to solve the integral numerically. I validated the results against computer aided design software. Thanks! Feb 24, 2021 at 17:34
• Great! If this answer solved your problem, it is customary to signal that by accepting it. Feb 24, 2021 at 19:33