Curve length of a function

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: http://www.swissmicros.com/dm42/decoder/

You can then copy/paste the listing and post it in "code" tags.
Post Reply
rawi
Posts: 2
Joined: Sat Dec 28, 2019 3:50 am

Curve length of a function

Post by rawi » Sun Jan 26, 2020 5:59 pm

The following little program computes the length of the curve of a function using the integration function.

Application:
The function of which you want to get the curve length has to be programmed under the label "FU". I use as an example the function y=4x²-x-3. But you can replace it by any other function as long as it can be differentiated within the limits you use.

Press the integration key. Select "CLENT" as the integration program. Select "X" for the variable. Put in the area of the function for which you want to have the length of the curve using LLIM and ULIM. Put in the accuracy you want ("ACC") and press the integration key.

For example using -0.75 as LLIM and 1 as ULIM (for these x the function 4x²-x-3 is zero, but this is not necessary) and an accuracy of .0001 you get as a result 6.5177 which is the exact value within the limits of the accuracy used.

Enjoy!

Best

Raimund

(Moderator surrounded code by "code" tags)

Code: Select all

{ 53-Byte Prgm }
LBL "CLENT"
MVAR "X"
RCL "X"
1E-4
-
XEQ "FU"
STO11
RCL "X"
1E-4
+
XEQ "FU"
RCL11
-
2E-4
./.
X²
1
+
SQRT
RTN
END

Code: Select all

{ 20-Byte Prgm }
LBL"FU"
MVAR "X"
ENTER
X²
4
*
X<>Y
-
3
-
RTN
END

Post Reply