Saturday, November 26, 2022

HP Prime CAS: Curvature

HP Prime CAS:  Curvature



Introduction


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



For the CAS functions, they take the form:


#cas

name(arguments):=

BEGIN

...

END;

#end


Clicking on the CAS checkbox will not put the #cas and #end delimiters.  And these programs will work in CAS mode only.



HP Prime CAS Program: crvfunc


#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


#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


#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





Until next time and have a great day, 


Eddie 


Source:


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


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

All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...