Showing posts with label spring. Show all posts
Showing posts with label spring. Show all posts

Saturday, March 21, 2026

TI-83 Premium CE Edition Python and Casio fx-92 Collège: Graphing Roses

TI-83 Premium CE Edition Python and Casio fx-92 Collège: Graphing Roses


Introduction


The scripts presented today will draw a rose with the following polar equation:


r = a * cos(n * Θ)


If n is odd, then the rose will have n petals, but if n is even, then the rose will have double the petals (2*n petals).



TI-83 Premium CE Edition Python (and TI-84 Plus CE Python): ROSE84.PY


from math import *

from turtle import *

t=Turtle()

t.clear()

t.hidegrid()

t.hideturtle()

t.pencolor(255,0,0)


# set pedal length

a=100

t.penup()

t.goto(a,0)


# ask for pedals

print(“** rose **”)

print(“odd n: n pedals”)

print(“even n: 2*n pedals”)

n=eval(input(“n? “))

t.clear()


# draw

t.pendown()

for i in range(129):

  # theta

  m=i/128*2*pi

  # r

  r=a*cos(n*m)

  t.goto(r*cos(m),r*sin(m))

t.done()






Casio fx-92 Collège: Graphing a Rose


Note: The instructions are in French.


INSTRUCTION

DETAIL

ENGLISH TRANSLATION

Style Criox


Cross Cursor Style

? → B

Demander valuer B

Input B

20 → A

Metrire var á 20 → A

Set A = 20

Aller á x = A; y = 0


Goto (A, 0)

Stylo écrit


Pen down

Répéter 128


Repeat 128 times (loop):

C ÷ 128 × 2 × π → D

Metrire var á C ÷ 128 × 2 × π → D

Set D = C/128*2*π

A × cos((B × D)^r) → E

Metrire var á A × cos((B × D)^r) → E

Set E = A*(cos(B*D)), B*D is in radians.

Aller à x=E×cos(D^r); y=E×sin(D^r)


Goto (E * cos D, E * sin D). D is in radians.

C + 1 → C

Metrire var á C + 1 → C

Set C = C + 1


End of loop


Note: To designate a measure of an angle to be radians regardless of calculator setting, press [ CATALOG ] >> Angl/Coord/Sexag >> Radians.






Drawing roses on the first day of spring,



Eddie


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

Saturday, March 9, 2024

Casio FX-702P, Swiss Micros DM42, HP 27S: Design of Coil Spring

Casio FX-702P, Swiss Micros DM42, HP 27S: Design of Coil Spring


Today’s blog calculates the load of a coil spring.


Variables Used


P

LOAD

Load (kg)

G

SHEAR

Shear Modulus (kg/mm^2)

A

WDIA, W.DIA

Diameter of the wire (mm)

Y

DEFL

Deflection (mm)

N, NA

#COIL

Number of Coils

D

CDIA, C.DIA

Diameter of the coil (mm)

K = (G×A^4)÷(8×N×D)


Spring Constant (kg/mm)
(FX-702P only)



Casio FX-702P Code


The original BASIC programs are listed here (Casio, pg. 72, Program Library FX-702P, see sources):

5 FOR L=1 TO 5

10 INP “K,P:1,A:2,D:3,NA:4”,I

20 FOR J=1 TO 4

30 IF I=J THEN 100

40 NEXT J

50 GOTO 10


100 INP “G=”,G

110 G=G/8

120 IF I=2 THEN 150

130 INP “A=”,A:A=A↑4

140 IF I=3 THEN 170

150 INP “D=”,D:D=D↑3

160 IF I=4 THEN 180

170 INP “NA”=,N

180 INP “Y=”,Y

190 IF I=1;K=G*A/N/D:P=K*Y:PRT “K=”;K,”P=”;P:GOTO 240

200 INP “P=”,P

210 IF I=2;A=(P*D*N/G/Y)↑(1/4):PRT “A=”;A:GOTO 240

220 IF I=3;D=(A*G*Y/N/P)↑(1/3):PRT “D=”;D:GOTO 240

230 N=G*A*Y/D/R:PRT “NA=”;N

240 NEXT L

250 END


INP: input

PRT: print


Swiss Micros DM42 Solver Code: SPRING


Also for HP 42S, Free42, Plus42.


00 { 103-Byte Prgm }
01▸LBL "SPRING"
02 MVAR "LOAD"
03 MVAR "SHEAR"
04 MVAR "W.DIA"
05 MVAR "C.DIA"
06 MVAR "#COIL"
07 MVAR "DEFL"
08 RCL "SHEAR"
09 RCL "W.DIA"
10 4
11 Y↑X
12 ×
13 RCL× "DEFL"
14 8
15 RCL× "#COIL"
16 RCL "C.DIA"
17 3
18 Y↑X
19 ×
20 ÷
21 +/-
22 RCL+ "LOAD"
23 RTN
24 .END.


Run SPRING through the SOLVER.



HP 27S Equation: SPRING


Spaces added for readability.


SPRING: SHEAR × WDIA^4 × DEFL ÷ (8 ×#COIL × CDIA^3)



Example: Copper Spring Coil


Shear: G = 4558.131472 kg/mm^2

Coil Diameter: D = 10 mm

Wire Diameter: A = 0.7 mm

Deflection: Y = 5 mm

Number of Coils: N = 4


Result: Load: P: 0.17100 kg



Calculate the wire diameter if the load is 0.25 kg.


Result: Wire Diameter: A: 0.79672 mm



What if instead we have 8 coils? Wire diameter resets to 0.7 mm.


Result: Load: P: 0.08550 kg




Table of Shear Modulus Values


These are the shear modulus of various mediums. The higher the shear modulus is, the more rigid the solid is. If the solid’s modulus is smaller, it is easier to deform or change its shape. For liquids, the modulus is zero. The table below has two units, GPa (gigapascal) and kg/mm^2. The conversion rate is approximately 1 GPa = 101.9716212978 kg/mm^2.


The values in are from the “What is the Shear Modulus?” article by Dr. Helmenstine (see the Sources section) in GPa.


Shear Modulus

GPa

kg/mm^2

Rubber

0.0006

0.06118297278

Plywood

0.62

63.2224052

Nylon

4.1

418.0836473

Lead

13.1

1335.828239

Aluminum

25.5

2600.276343

Brass

40

4078.864852

Copper

44.7

4558.131472

Titanium

41.1

4191.033635


Source:


Casio. Program Library: FX-702P pp. 71-72 (English)

Helmenstine, Anne Marie, Ph.D. "What Is the Shear Modulus?" ThoughtCo, Feb. 17, 2021, thoughtco.com/shear-modulus-4176406. Retrieved January 21, 2024.

TranslatorsCafe.com “Convert gigapascal [GPa] to kilogram-force/millimeter² [kgf/mm²]”

https://www.translatorscafe.com/unit-converter/en-US/pressure/5-28/gigapascal-kilogram-force/millimeter%C2%B2/ Retrieved January 21, 2024



Eddie


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


Sunday, November 27, 2016

TI-84 Plus and HP Prime: Differential Equations and Half-Increment Solution, Numerical Methods

TI-84 Plus and HP Prime:  Differential Equations and Half-Increment Solution, Numerical Methods

Introduction

The program HALFSTEP solves the numerical differential equation

d^2y/dt^2 = f(dy/dt, y, t)  given the initial conditions y(t0) = y0 and dy/dt (t0) = dy0

In this notation, y is the independent variable and t is the dependent variable.

The Method

Let C = f(dy/dt, y, t).  Give the change of t as Δt.

First Step:

With t = t0:
h_1/2 = dy0 + C * Δt/2
y1 = y0 + dy0 * Δt

Loop:

t = t0 + Δt
h_I+1/2 = h_I-1/2 + C * Δt
y_I+1 = y_I +h_I+1/2 * Δt

Repeat as many steps as desired.

This method was presented by Robert M. Eisberg in his 1976 calculator programming book (see source below).

Variables

The program uses the following variables:

C:  d^2y/dt^2.   Represent dy/dt as the variable A, y as the variable Y, and t as the variable T.

The program will always designate Y as the independent variable and T as the dependent variable.

Examples:

Application
C
C for HALFSTEP
Free-Fall
d^2y/dt^2 = g
“9.80665” (SI) or “32.1740468” (US)
Free-Fall with Friction
d^2y/dt^2 = g - α (dy/dt)^2
(α = F/m)
“g - α * A^2”
(sub numeric values for g, α)
Spring
d^2x/dt = -k/m * x
“-k/m * T”
(sub numeric values for k, m)
Pendulum
d^2θ/dt = -α*sin(θ)
(α = -g/l)
“-α * sin(Y)”
(sub numeric values for α)
Damped, Driven Oscillations
d^2x/dt = -α*x – β*dx/dt + γ * sin(ω*t)
“-α*Y-β*A+γ*sin(ω*T)”
(sub numeric values for α, β, γ)


HP Prime Program HALFSTEP

Input:  C.  Use single quotes to enclose d^2y/dt^2.  Represent dy/dt as A, y as Y, and t as T. 

Output:  A matrix of two columns, t and y.

EXPORT HALFSTEP(c,A,Y,D,tmax)
BEGIN
// d^2y/dt^2=C,dy0,y0,Δt,tmax
// EWS 2016-11-17
// C use single quotes
// 'dy=A, y=Y, t=T'

// Radian mode
HAngle:=0;

LOCAL mat:=[[0,Y]],T,H;
LOCAL K:=3,I;

T:=D;
H:=A+EVAL(c)*D/2;
Y:=Y+H*D;
mat:=ADDROW(mat,[D,Y],2);

FOR I FROM 2*D TO tmax STEP D DO
T:=I; A:=H;
H:=H+EVAL(c)*D;
Y:=Y+H*D;
mat:=ADDROW(mat,[I,Y],K);
K:=K+1;
END;

RETURN mat;

END;

TI-84 Plus Program HALFSTEP

Input:  For C, use enclose d^2y/dt^2 in quotes.  Represent dy/dt as A, y as Y, and t as T. 

Output:  A matrix of two columns, t and y.

"EWS 2016-11-27"
Func
Radian
Disp "D²Y/DT²=C"
Disp "USE A=DY/DT,Y,T"
Input "C, USE A STRING:",Y1
Input "DY0:",A
Input "Y0:",Y
Input "DELTA TIME:",D
Input "TIME MAX:",N
[[0][Y]]→[A]
D→T
A+Y1*D/2→H
Y+H*D→Y
augment([A],[[D][Y]])→[A]
For(I,2D,N,D)
I→T:H→A
H+Y1*D→H
Y+H*D→Y
augment([A],[[I][Y]])→[A]
End
[A]^T→[A]

Examples:

Please see the screen shots below.  Both are screen shots from the TI-84 Plus.







Source:  Eiseberg, Robert M.  Applied Mathematical Physics with Programmable Pocket Calculators  McGraw-Hill, Inc:  New York.  1976.  ISBN 0-07-019109-3


This blog is property of Edward Shore, 2016.

Sunday, April 8, 2012

Taking Some Mystery Out Of Baseball Statistics

Welcome to Blog Entry #70.

A shout to all who are following my blog. Many sincere thanks!

This will probably be my first anniversary post, even though it is still about a week away. I started this blog on April 16, 2011.

If you have any math or calculator questions, please feel free to leave a comment - I will do my best to answer it. Maybe your question becomes a future blog entry. Thanks!




Today's blog entry will cover baseball statistics. Any one who follows baseball, especially in America, will hear tons of statistics for each player, for every single kind of situation possible. I guess this is how a lot of people keep busy watching the sport.

I am going to go over some of the more common statistics. Apparently the only thing complex about statistics is the amount of statistics and abbreviations and not the mathematics itself.

Baseball Stats

BA: Batting Average

BA = H / AB

The higher, the better.


H = the number of hits a player makes. This is each time a player successfully reaches at least one base after hitting a pitch.

AB = number of at-bats, the number of the times a player appears in front of a pitcher. However an at-bat does not include situations when the batter walks (receives four pitches deemed to be "balls"), the batter is hit by a pitch, or hits a sacrifice (intentionally bats out to get a teammate to score a run).

Examples:
Note: All examples use statistics from the 2011 season - provided by MLB and ESPN. All calculations result in three decimal places.

Matt Kemp, Los Angeles Dodgers: 195 hits in 602 at bats
BA = 195 / 602 = .324

Evan Longoria, Tampa Bay Rays: 118 hits in 483 at bats
BA = 118 / 483 = .244

SLG: Slugging Percentage

SLG = TB / AB = (singles + 2 * doubles + 3 * triples + 4 * home runs) / AB

The higher the better.


TB = total bases, a weighted sum of hits

Matt Kemp: 353 total bases in 602 at bats
SLG = 353 / 602 = .586

Evan Longoria: 239 total bases in 483 at bats
SLG = 239 / 483 = .495

ERA: Earned Run Average

ERA = 9 * ER / IP

The lower, the better.


ER = earned runs scored, in this case, by the opponent. This does not include any runs scored by "errors".

IP = innings pitched. Innings are counted by outs. So if a pitcher threw for six innings and got two outs in the seventh inning, the pitcher has pitched for 6 2/3 innings.

Caution: For IP, some statisticians use shortcut notation. For an IP listed as n.1, it means n and 1/3 innings. (n is a number). If the IP is listed as n.2, it means n and 2/3 innings. Example: A listed IP of 233.1, it means 233 1/3.

Clayton Kershaw, Cy Young Award Winner, Los Angeles Dodgers: 59 earned runs allowed in 233 1/3 innings pitched.
ERA = 9 * 59 / (233 1/3) = 2.276

Chris Carpenter of the 2011 World Series Champions St. Louis Cardinals: 91 earned runs in 237 1/3 innings pitched.
ERA = 9 * 91 / (237 1/3) = 3.451

K/9: Strikeouts Per 9 Innings Pitched

K/9 = 9 * K / IP

The higher, the better.


K = strike out. A pitcher gets this when the pitcher gets the batter to swing and miss on a pitch which results in Strike 3 (symbolized by a forward K), or the pitcher throws the ball to a batter's strike zone but the batter does nothing and is thrown out on Strike 3 (symbolized by a backwards K). Any batter who gets Strike 3 is out.

Per ESPN, Clayton Kershaw's K/9 for 2011 was 9.57 while Chris Carpenter's was 7.24. A K/9 above 9 is considered excellent.

RC: Runs Created (Bill James)

RC = (TB * (H + BB)) / (AB + BB)

The higher the better.


BB = base on balls. A BB is earned when a hitter takes a pitched deemed Ball 4 (the pitcher missed).

This is an estimate of runs created and not a count of the number of runs the player scored.

Paul Konerko, Chicago White Sox: 281 total bases, 163 hits, 77 walks in 543 at bats
RC = (281 * (163 + 77)) / (543 + 77) = 108.774 (estimated 109 runs created)

RBI: Runs Batted In

Commonly known as "ribbys", a batter gets an RBI every time the team scores a run that do not result from "errors". A batter can get up to four RBIs every time the batter is at bat.

Example: A batter has teammates at second and third base. The batter hits a double going to second base, allowing both teammates to reach home base. The batter scores 2 RBIs.

WHIP: Walks and Hits Per Innings Pitched

WHIP = (BB + H)/IP

The lower the better, real good of WHIP is below 1.


C.J. Wilson, was with the Texas Rangers in 2011, now with the Los Angeles Angels of Anaheim in 2012: 74 walks (BB), 191 hits allowed, 233 1/3 innings pitched
WHIP = (74 + 191)/(233 1/3) = 1.187


WAR: Wins Above Placement

Thankfully this is not a measurement of a baseball player's ability to use a weapon. WAR is an encompassing statistic of a player's contribution both offensively and defensively. You may have seen WAR graphs on various sports web sites. Generally, if your WAR is above 8, you are MVP material. If your WAR is around 5, you are an All-Star. If your WAR is around 2, you're an average starter. WAR at 0 and... you will most likely soon to be replaced with a minor leaguer.


These are just some of the statistics that baseball uses. Now it's time to go grab a soda and a hot dog - PLAY BALL!



Source:

MLB Clubhouse - Glossary Page

This blog is property of Edward Shore. © 2012

Python – Earth’s Radius and Gravity in US Units

Python – Earth’s Radius and Gravity in US Units Introduction The following script, gravus2.py, estimates the Earth’s gravity i...