Showing posts with label curvature. Show all posts
Showing posts with label curvature. Show all posts

Saturday, December 20, 2025

Basic vs. Python: Helix Curve (with Casio fx-CG 50)

Basic vs. Python: Helix Curve (with Casio fx-CG 50)



Calculators Used: Casio fx-CG100, Casio fx-CG50



The Helix Curve



The helix space curve can be defined with the following set of parametric equations:



x(t) = r × cos(t)

y(t) = r × sin(t)

z(t) = c × t

where r = radius, c = spacing between the coils of the helix



We can use any measurement of length we want, such as meters, feet, or inches, as long as our measurements are consistent.



Graphing the Helix Equation



Regarding calculators, 3D parametric equations can be graphed with the Casio fx-CG 50, fx-CG 100 (independent variables s and t), and the TI-Nspire (independent variables t and u). The screenshots below is a graph of a helix with the use of the fx-CG 100 emulator (classpad.workspace.com):






Curvature, Torsion, and Arc Length of a Helix



For the formulas, let

x = r × cos(t), x’ = -r × sin(t), x’’ = -r × cos(t), x’’’ = r × sin(t)

y = r × sin(t), y’ = r × cos(t), y’’ = -r × sin(t), y’’’ = -r × cos(t)

z = c × t, z’ = c, z’’ = 0, z’’’ = 0



The variable t is the independent variable of x(t), y(t), and z(t).



Curvature



The general formula for curvature:

k² = ((x’² + y’² + z’²) × (x’’² + y’’² + z’’²) – (x’ × x’’ + y’ × y’’ + z’ × z’’)) ÷ (x’² + y’² + z’²)³



Applying to the helix:

k² = ((r² sin² t + r² cos² t + c²) × (r² cos² t + r² sin² t + 0) – (r² sin t cos t – r² sin t cos t + 0)) ÷ (r² sin² t + r² cos² t + c²)³

Note: r² sin² t + r² cos² t = r² × (sin² t + cos² t) = r²

k² = ((r² + c²) × r²) ÷ (r² + c²)³

k² = r² ÷ (r² + c²)²

k = r ÷ (r² + c²)

Note: curvature is assumed to be a positive value





Torsion



The general formula for torsion:

τ =

(x’’’ × (y’ × z’’ – y’’ × z’) + y’’’ × (x’’’ × z’ – x’ × z’’’) + z’’’ × (x’ × y’’ – x’’ × y’))

÷ ((y’ × z’’ – y’’ × z’)² + (x’’ × z’ – x’ × z’’)² + (x’ × y’’ – x’’ × y’)²)



Breaking it down into parts:



x’’’ × (y’ × z’’ – y’’ × z’) = r × sin t × (0 - -r × sin t × c) = r² × c × sin² t

y’’’ × (x’’’ × z’ – x’ × z’’’) = -r × cos t × (-r × cos t × c – 0) = r² × c × cos² t

z’’’ × (x’ × y’’ – x’’ × y’) = 0

x’’’ × (y’ × z’’ – y’’ × z’) + y’’’ × (x’’’ × z’ – x’ × z’’’) + z’’’ × (x’ × y’’ – x’’ × y’)

= r² × c × sin² t + r² × c × cos² t + 0 = r² × c



(y’ × z’’ – y’’ × z’)² = (0 - -r × sin t × c)² = r² × c² × sin² t

(x’’ × z’ – x’ × z’’)² = (-r × cos t × c – 0)² = r² × c² × cos² t

(x’ × y’’ – x’’ × y’)² = (r² sin² t + r² cos² t)² = r^4

(y’ × z’’ – y’’ × z’)² + (x’’ × z’ – x’ × z’’)² + (x’ × y’’ – x’’ × y’)²

= r² × c² × sin² t + r² × c² × cos² t + r^4 = r² × c² + r^4 = r² × (c² + r²)



Then:

τ = (r² × c) ÷ (r² × (c² + r²)) = c ÷ (r² + c²)





Arc Tangent from t = 0 to t = x



s = ∫ √(x’² + y’² + z’²) dt from t = 0 to t = x



Since:

x’² + y’² + z’² = r² sin² t + r² cos² t + c² = r² + c²



Then:

s = ∫ √(x’² + y’² + z’²) dt from t = 0 to t = x

= ∫ √(r² + c²) dt from t = 0 to t = x

= x × √(r² + c²)



To summarize, for the helix curve:

Curvature: k = r ÷ (r² + c²)

Torsion: τ = c ÷ (r² + c²)

Arc Length to x: s = x × √(r² + c²)



The code below calculates the following:

* curvature

* torsion

* arc length to 2π



Casio fx-CG50 Program HELIXFX



"HELIX: CASIO BASIC"

"RADIUS"?→R

"SPACING"?→c

"CURVATURE="

R÷(R²+C²)→K ◢

"TORISON="

C÷(R²+C²)→T ◢

"ARC LENGTH TO 2π="

2×π×√(R²+C²)→S



Python Script: helixp.py



from math import *

print("Helix: Parameters")

print("math module imported\n")

r=eval(input("radius? "))

c=eval(input("spacing? "))

k=r/(r**2+c**2)

t=c/(r**2+c**2)

print("curvature=\n",str(k))

print("torsion=\n",str(t))

print("arc length to 2pi=\n",str(s))



Example



Radius: r = 2.75

Spacing: c = 0.89



Outputs:

Curvature: 0.3291599837

Torsion: 0.1065281402

Arc length to 2π: 18.16112298



Sources



Harris, John W. and Horst Stocker. Handbook of Mathematics and Computational Science Springer: New York, NY. 2006. ISBN 978-0-387-94746-4

Lee, Sarah. “Curvature and Torsion of 3D Parametric Curves.” Number Analytics // Super Easy Data Analysis Tool for Research, May 17, 2015, www.numberanalytics.com/blog/curvature-torsion-3d-parametric-curves . Accessed 02 July 2025.

Weisstein, Eric W. "Helix." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Helix.html Accessed July 2, 2025.

Wikimedia Foundation. “Torsion of a curve.” Wikipedia. Lasted Edited January 2, 2023, https://en.wikipedia.org/wiki/Torsion_of_a_curve Accessed July 2, 2025.


Eddie

 All original content copyright, © 2011-2025. 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.

The author does not use AI engines and never will.


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. 


Earth's Radius by Latitude

Earth's Radius by Latitude Introduction: Calculating the Earth’s Radius In quick, general calculations, we assume that the...