Line Integrals

Description

Published by Marcel Pelletier, July 2023, in the MoHPC - General Software Library

This document shows how to use the integral function yx, in a program, to calculate the line integrals c f(x,y) ds

Line integrals

Program D (Numerical Derivative) uses registers .0 , .1 and register I for indirect branching. Program E (Line integrals) use registers 1, 2, 3 and register I for indirect branching. The user-defined functions (label A, label B and label C) can be added at the end of the program memory. The formula used for the Line integrals is
c f(x,y) ds = ∫ab f(x(t), y(t)) √((dx/dt)2 + (dy/dt)2) dt

The function f(x,y) is input on a parametric form f(x(t),y(t)) by the user. x(t) at label A and y(t) at label B.
The function f(x,y) is input at label C, by replacing x by GSB A and y by GSB B.

Examples

Example 1:
Evaluate c(2+x²y) ds where c is the upper half of the unit circle x² + y² = 1. The parametric equations to represent c is x=cos t and y=sin t.

In PRGM mode:
Delete any existing program at and after label A.

f LBL A
COS
g RTN

f LBL B
SIN
g RTN

f LBL C
STO 0
GSB A
g
RCL 0
GSB B
×
2
+
g RTN

In RUN mode:
0 ENTER → 0.0000
g π f xy E → 6.9499 (Value of the integral.)
The exact value is 2π+2/3.

Example 2:
Evaluate cxy⁴ds where c is the right half of the unit circle x² + y² = 16. The parametric equations to represent c is x=4cos t and y=4sin t and /2 ≤ t ≤ π/2.

In PRGM mode:
Delete any existing program at and after label A.

f LBL A
COS
4
×
g RTN

f LBL B
SIN
4
×
g RTN

f LBL C
STO 0
GSB A
RCL 0
GSB B
4
yx
×
g RTN


In RUN mode:
g π CHS 2 ÷ → -1.5708
ENTER CHS f xy E → 1,638.4000 (Value of the integral)

Program Resources

Labels

Name Description
 C # User function
 D Numerical Derivative
 E Line Integral

Storage Registers

Name Description
 1
 2
 3
.0 Save x value
.1 0.0001
I used for indirect branching

Program

Line Display Key Sequence Line Display Key Sequence
000 018 44 1 STO 1
001 42,21,14 f LBL D 019 32 13 GSB C
002 44 .0 STO . 0 020 44 2 STO 2
003 26 EEX 021 2 2
004 16 CHS 022 0 0
005 4 4 023 44 25 STO I
006 44 .1 STO . 1 024 45 1 RCL 1
007 40 + 025 32 14 GSB D
008 32 25 GSB I 026 44 3 STO 3
009 45 .0 RCL . 0 027 2 2
010 45,30, .1 RCL . 1 028 1 1
011 32 25 GSB I 029 44 25 STO I
012 30 030 45 1 RCL 1
013 2 2 031 32 14 GSB D
014 45,20, .1 RCL × . 1 032 45 3 RCL 3
015 10 ÷ 033 43 1 g →P
016 43 32 g RTN 034 45,20, 2 RCL × 2
017 42,21,15 f LBL E 035 43 32 g RTN