Tuesday, January 20, 2009

Faster numeric arc lengths on the Voyage 200 and TI-89

The built-in arclen() function will return a numeric result for an arc length if a symbolic solution cannot be found. For example,

arclen(-x^3 + 3*x^2 - 2x + 2/x - 2/x^2 + 1, x, .769, 2.428)

returns 4.2413 in about 62 seconds in APPROX mode. We can speed this up by using nint() to numerically integrate the arc length integrand, as follows.

First define a simple function to find the arc length integrand:

: arcleni(f,x)
: Func
: sqrt((d(f,x))^2+1)
: EndFunc

where f is the function of the desired arc length and x is the independent variable. d() is the built-in derivative function. We then find the arc length with

nint(arcleni(-x^3+3*x^2-2x+2/x-2/x^2+1,x),x,.769,2.428)

which returns the arc length in about 27 seconds, saving 35 seconds.

It is likely that arclen() spends the extra time trying to find a symbolic solution before falling back to the numerical integration.

0 Comments:

Post a Comment

<< Home