HP Forums
Curvature - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Curvature (/thread-18941.html)



Curvature - Eddie W. Shore - 10-07-2022 12:28 AM

Gratitude to Arno K. and rombio for helping me with derivatives and CAS programs.


The following CAS functions calculates the curvature of:

functions, y(x)
polar functions, r(t) (t: Θ)
parametric functions, x(t), y(t)

Let Δα be the angle of rotation angle and Δs is the slight change of distance. Then the radius of curvature is:

K = abs(Δα ÷ Δs) as Δs → 0

And the radius of curvature is the reciprocal of K.

For circles, the radius of curvature is constant. Wankel engines and rotary engines have their pistons traveling in a circle.

Calculating the curvature depends on the form of the function.

Function: y(x)

K = abs( y''(x) ) ÷ (1 + (y'(x))^2) ^(3/2)

Polar: r(t) (t replaces Θ)

K = abs( r(t)^2 + 2 * (r'(t))^2 - r(t) * r''(t) ) ÷ ( r(t)^2 + r'(t)^2 )^(3/2)

Parametric: x(t), y(t)

K = abs( x'(t) * y''(t) - y'(t) * x''(t) ) ÷ ( x'(t)^2 + y'(t)^2 )^(3/2)

Radius of Curvature:

r = 1 ÷ K

HP Prime CAS Program: crvfunc

Code:
#cas
crvfunc(y,x):=
BEGIN
// curvature
// function
// radius = 1/curvature
LOCAL a,b;
a:=diff(y,x,2);
b:=diff(y,x,1);
RETURN ABS(a)/(1+b^2)^(3/2);
END;
#end

HP Prime CAS Program: crvpol

Code:
#cas
crvpol(r,t):=
BEGIN
// curvature
// polar (t: θ)
// radius = 1/curvature
LOCAL a,b,n,d;
a:=diff(r,t,2);
b:=diff(r,t,1);
n:=simplify(r^2+2*b^2-r*a);
d:=r^2+b^2;
RETURN ABS(n)/(d)^(3/2);
END;
#end

HP Prime CAS Program: crvpar

Code:
#cas
crvpar(y,x,t):=
BEGIN
// curvature
// parametric
// radius = 1/curvature
LOCAL y1,y2,x1,x2,n,d;
y2:=diff(y,t,2);
y1:=diff(y,t,1);
x2:=diff(x,t,2);
x1:=diff(x,t,1);
n:=simplify(x1*y2-y1*x2);
d:=simplify(x1^2+y1^2); 
RETURN ABS(n)/(d)^(3/2);
END;
#end

Source:

Svirin, Alex Ph.D. "Curvature and Radius of Curvature" Math24 https://math24.net/curvature-radius.html 2022. Last Updated September 12, 2022.


RE: Curvature - FireBunny42 - 09-24-2023 08:21 AM

These programs seem to be having some trouble running. I'm getting the error (!) when I try to run them from the Program menu, and they simply don't pop up in the User>Program Functions list. I'm wondering if you might have a sec to trouble shoot?

Actions I've tried:

Copied & pasted the exact text for each program via HP Connectivity Kit

Attempted to locate the program using Catlg, calc displays 100% read only code

Uninstalled & reinstalled programs

Reset HP Prime via pinhole reset on back


Hopefully I'm doing something wrong, and that something is obvious and you spot it easily so I can learn from the mistake.