Showing posts with label ellipse. Show all posts
Showing posts with label ellipse. Show all posts

Saturday, August 10, 2024

Some Equations for the HP 22S

 Some Equations for the HP 22S




The [ 2 ] key has the letter X.  


These equations should work for the HP 27S, HP 32S/DM32, or Plus42.


Equations


Answers are shown to five decimal places.


Snell’s Law


Equation: Set Degrees Mode

N × SIN(T) = M × SIN(I)


T, I: reflection angles

N, M: refractive indices (1 for air, about 1.33 for water, etc.)


Examples:

Inputs: N = 1, T = 30°, I = 60°, Result: M ≈ 0.57735

Inputs: N = 1, M = 1.3333, I = 35.4°, Result: T ≈ 50.56589°

Inputs: N = 1, M = 1.3333, T = 100°, Result: I ≈ 47.61436°



Gudermannian and Inverse Gudermannian Functions


Equation: Set Radians Mode

G = 2 × ATAN( TANH( X ÷ 2 ) )


G = gd(X)

X = gd^-1(G)


Examples:

Input: X = 0.5, Result: G ≈ 0.48038

Input: X = 2.3, Result: G ≈ 1.37095

Input: G = -0.1, Result: X ≈ -0.10017

Input: G = 1, Result: X ≈ 1.22619



AC Current Equation


Equation: Set Radians Mode

I = P × SIN( W × T + H )


I = current at time T seconds in amps

P = peak current in amps

W = radian frequency = 2 * π * f

H = phase angle in radians


Examples:

Inputs: P = 10, W = 0.8, H = 0, T = 10, Result: I ≈ 9.89358

Inputs: P = 10, W = 2 * π * 60, H = 0.7, T = 10, Result: I ≈ 6.44218

Inputs: I = 15, W = 2 * π * 60, H = 0.6, T = 10, Result: P ≈ 26.56548



Air Pressure Up to 36,089 Feet


Equation:

P = 29.92126 × (1 – 6.875E-6 × H) ^ 5.255876329


H = height in feet

P = standard pressure in inHg (inches of Mercury)

The equation is giving with all the constants calculated.


(see https://edspi31415.blogspot.com/2024/06/casio-fx-4000p-programs-i-took-on.html , Prog 8)


Inputs: H = 1347, Result: P ≈ 28.49332

Inputs: H = 4126, Result: P ≈ 25.72143

Inputs: P = 22, Result: H ≈ 8266.49833




Law of Cosines





SQ(Z) = SQ(X) + SQ(Y) – 2 × X × Y × COS( C )


SQ: square function (x^2)

X, Y, Z = sides

C = angle that correspond to side Z


Examples:

Inputs: X = 10, Y = 12, C = 30°

Result: Z ≈ 6.01281 or Z ≈ 14.38679 (depending on the initial guess for Z)


Inputs: X = 55.44, Y = 37.85, Z = 62.17

Result: C ≈ 81.21305°



Ellipse Equation


The center of the ellipse is set at (0, 0).





Equation:

SQ(X ÷ A) + SQ(Y ÷ B) = 1


If A = B, we are working with a circle.


Examples:

Inputs: A = 5, B = 5, X = 4.9,

Result: Y ≈ 0.99499 (1 as a guess)

or Y gives a no solution error (0 as a guess)

(Your mileage may vary)


Inputs: A = 10, X = 8, Y = 12, Result: B = 20


Inputs: A = 10, X = -4, Y = 6

Result: B ≈ 6.54654 (10 as a guess)

but returns a divide by zero error for other guesses (20)


To store an initial guess on the HP 22S, be out of equation mode and store the guess in the variable you are trying to solve for.


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, July 7, 2024

Numworks: Drawing Simple Shapes with Pyplot

 Numworks: Drawing Simple Shapes with Pyplot


Welcome to a special edition of our blog.


The goal of today’s blog is provide templates to draw simple shapes such as ellipses, circles, rectangles, squares, equilateral triangles, and 45-45-90 right triangles. Adjust the position, screen size, and colors as you see fit.


The module is used is pyplot.



Ellipses and Circles with drawellipse.py


Draw an ellipse given the length of x and y radii. If x and y are equal, a circle is drawn. The screen is set up to fit the proportion of the 320 x 220 screen. The vertical axis ranges from y = -44 to y = 44 while the horizontal axis ranges from x = -64 to x = 64. The ellipse is centered at (0,0).


Numworks script: https://my.numworks.com/python/ews31415/drawellipse


Script: drawellipse.py


from math import *
from matplotlib.pyplot import *

print("Draw an ellipse\nusing pyplot")
a=eval(input("x axis? "))
b=eval(input("y axis? "))

# set axis
axis((-64,64,-44,44))

# set points
tl=[i/128*2*pi for i in range(129)]
xl=[a*cos(i) for i in tl]
yl=[b*sin(i) for i in tl]

# draw the ellipse
c='purple'
plot(xl,yl,c)
show()




Rectangles and Squares with drawrect.py


Draw a rectangle given its horizontal length (h) and vertical length (v). If the horizontal and vertical lengths are equal, a square is drawn. The rectangle is centered at (0, 0). The screen is set up to fit the proportion of the 320 x 220 screen. The vertical axis ranges from y = -44 to y = 44 while the horizontal axis ranges from x = -64 to x = 64.


Numworks script: https://my.numworks.com/python/ews31415/drawrect


Script: drawrect.py


from math import *
from matplotlib.pyplot import *

print("Draw a rectangle\nusing pyplot")
h=eval(input("horiz. length? "))
v=eval(input("vert. length? "))

# set axis
axis((-64,64,-44,44))

# set points
xl=[-h/2,h/2,h/2,-h/2,-h/2]
yl=[v/2,v/2,-v/2,-v/2,v/2]

# color
c='green'

# draw rectangle
plot(xl,yl,c)
show()




Equilateral Triangles with drawtrieq.py


Draws an equilateral (60-60-60) triangle. Enter the length of the side (s). The base is set on the x-axis. The screen is set up to fit the proportion of the 320 x 220 screen. The vertical axis ranges from y = -44 to y = 44 while the horizontal axis ranges from x = -64 to x = 64.


Numworks script: https://my.numworks.com/python/ews31415/drawtrieq


Script: drawtrieq.py


from math import *
from matplotlib.pyplot import *

print("Draw an equilateral triangle\nusing pyplot")
s=eval(input("side length? "))

# set axis
axis((-64,64,-44,44))

# set points
t=s*sqrt(3)/2
xl=[-s/2,s/2,0,-s/2]
yl=[0,0,t,0]

# draw the triangle
c='brown'
plot(xl,yl,c)
show()




45-45-90 Degree Right Triangles with drawtrit.py


Draws an 45-45-90 degree right triangle. Enter the length of the one of the legs (s), not the hypotenuse. The base is set on the x-axis. The screen is set up to fit the proportion of the 320 x 220 screen. The vertical axis ranges from y = -44 to y = 44 while the horizontal axis ranges from x = -64 to x = 64.


Numworks Script: https://my.numworks.com/python/ews31415/drawtrirt


Script: drawtrit.py


from math import *
from matplotlib.pyplot import *

print("Draw a 45-45-90 triangle\nusing pyplot")
s=eval(input("short length? "))

# set axis
axis((-64,64,-44,44))

# set points
xl=[-s/2,s/2,-s/2,-s/2]
yl=[0,0,s,0]

# draw the triangle
c='blue'
plot(xl,yl,c)
show()




Enjoy and I hope you find these scripts useful in your drawing scripts.


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, March 10, 2024

Fun with the TI-81 (March 2024 Edition)

Fun with the TI-81 (March 2024 Edition)






TI-81 SCATTER







Produces a scatter plot.


Size: 52 bytes


Code:


If Dim{x}=0

Disp “NO DATA”

If Dim{x}=0

Stop

ClrDraw

1→I

Lbl 0

PT-On({x}(I),{y}(I))

IS>(I,Dim{x})

Goto 0

DispGraph


Note: Dim{x} returns the number of data points in the statistics list {x}.

Keystrokes: [ VARS ], DIM, 7: Dim{x}



TI-81 ANGLES


Given three pints, the internal and external angle are calculated.





Size: 196 bytes


Code:

Deg

Disp “SIDE PT (S,T)”

Input S

Input T

Disp “CORNER (M,N)”

Input M

Input N

Disp “SIDE PT (U,V)”

Input U

Input V

(S-M)*(U-M)+(T-N)*(V-N)→D

√((S-M)^2+(T-N)^2)→A

√((U-M)^2+(V-M)^2)→B

cos^-1 (D/(A*B))→I

360-I→E

Disp “INTERNAL ANGLE”

Disp I

Disp “EXTERNAL ANGLE”

Disp E



Example:

(S,T) = (-4,-6)

(M,N) = (1,1)

(U,V) = (3,5)



INTERNAL ANGLE: 171.0273734

EXTERNAL ANGLE: 188.9726266


Source:

Cook, John D. “Ramanujan approximation for circumference of ellipse” John D. Cook Consulting. May 5, 2015. https://www.johndcook.com/blog/2013/05/05/ramanujan-circumference-ellipse/ Accessed January 24, 2024


TI-81 ELLIPSE

Given the length of the semi-axis, the program draws the ellipse, calculates the area, and approximates the circumference using Ramanujan formula.

Size: 195 bytes


Code:


Param

Rad

Disp “SEMI X-AXIS”

Input A

Disp “SEMI Y-AXIS”

Input B

(A-B)/(A+B)→L

π*(A+B)*(1+(3*L^2)/(10+√(4-3*L^2))→P

π*A*B→R

Disp “APPROX. CIR=”

Disp P

Disp “AREA=”

Disp R

Pause

All-Off

“A*cos T”→X_1T

“B*sin T”→Y_1T

X1T-On

-A-1→Xmin

A+1→Xmax

-B-1→Ymin

B+1→Ymax

0→Tmin

2π→Tmax

π/24→Tstep

DispGraph



Notes:

All-Off turns all the graphing equations off from graphing.

[ 2nd ] {Y-VARS}, OFF, 1: All-Off



XT1 and YT1 are the equation variables x1(t) and y1(t):

[ 2nd ] {Y-VARS}, Y, 5: X_1T and 6: Y_1T, respectively



Example:


SEMI X-AXIS? 2

SEMI Y-AXIS? 3



Results:

APPROX. CIRC= 15.86543959

AREA= 18.84955592






TI-81 RELATIVE

Calculate the consequences of reality when it comes to a length and mass of an object traveling near the speed of light, c = 299,792,458 m/s.


Size: 141 bytes


Code:

299792458→C

Disp “C=”

Disp C

Disp “M/S”

Pause

Disp “°/. OF C”

Input P

P*C/100→U

√(1-(U/C)^2)→V

Disp “LENGTH”

Input L

Disp “OBS LENGTH=”

L*V→K

Disp K

Pause

Disp “MASS”

Input M

Disp “OBS. MASS=”

M/V→N

Disp N


Enter the percentage of the speed of light (70%, 80%, 90%, etc.). Three characters are used to create the percent sign (%) (°, / , . )


Example:


92.5% of the speed of light

length: 40.8 m

mass: 6,700 kg


Results:

observed length = 15.50265784 m

observed mass = 17,633.10542 kg


Source:


Jackson, Mark D. The QuickStudy for Physics BarCharts Publishing Inc. Boca Raton, Florida. 2007. ISBN 13: 9781423202677. pp. 114-115

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.


Saturday, March 18, 2023

TI-84 Plus CE: Tracing Polar Equations

TI-84 Plus CE:  Tracing Polar Equations



Traveling Around the Graphs


The programing BLINKING animates a dot around one of four polar equations:


1.  Ellipse


r = b / √(1 - ε^2 * cos^2 θ), where ε = √(a^2 - b^2)/a, a > b


2.  Cardioid


r = a + (1 + cos θ)


3.  3-Leaf Rose


r = a * cos(3 * θ)


4.  Log Spiral


r = a * e^(b * θ)



Notes:


The point alternates through blue (TI-84 Plus CE color 10), green (14), orange (15), and black (12).   The graph itself is light gray (21).  


r1 is the polar equation r1(θ).


Plotting points (not the polar graph) must be in cartesian coordinates (x,y).   




TI-84 Plus CE Program:  BLINKING


"2023-01-15 EWS"

Radian: Polar: FnOff

ZStandard

{10,14,15,12}→L6

Menu("PLOT","ELLIPSE",10,"CARDIOID",11,"3-LEAF ROSE",12,"LOG SPIRAL",13)


Lbl 10

Disp "A≥B"

Prompt A, B

√(A^2-B^2)/A→E

"B/√(1-E^2*cos(θ)^2)"→r1

Goto 20


Lbl 11

Prompt A

"A*(1+cos(θ))"→r1

Goto 20


Lbl 12

Prompt A

"A*cos(3*θ)"→r1

Goto 20


Lbl 13

Disp "A>0, B>0"

Prompt A,B

"A*e^(B*θ)"→r1

Goto 20


Lbl 20

Input "MAX? ",M

Input "NO. STEPS? ",S

M/S→N

FnOn 1

GraphColor(1,21)

0→P: r1(P)→Q

P>Rx(Q,P)→F: P>Ry(Q,P)→G

Pt-On(F,G,1,12)


For(K,1,S)

Wait 0.25

Pt-On(F,G,1,21)

remainder(K,4)+1→C

K*N→P: r1(P)→Q

P>Rx(Q,P)→F: P>Ry(Q,P)→G

Pt-On(F,G,1,L6(C))

End 


Disp "END"



Examples


In all examples, a = 3, b = 2, maximum = 4 * π, steps = 24


Ellipse





Cardioid




 

3-Leaf Rose





Log Spiral







Source


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



Eddie


All original content copyright, © 2011-2023.  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, June 12, 2021

7000G Retro Month - June 12 Edition

7000G Retro Month - June 12 Edition



Introduction


Welcome to the 7000G Retro Month, which features programming for the classic Casio calculators from the mid/late 1980s:  primarily fx-7000G and fx-7500G.  Since the programming language stays similar throughout the years, programs can be translated to the fx-6300G and later graphing calculators with little to no adjustments.  Non graphic programs should be ported to the fx-4000P, fx-4500P (A), fx-3650p (II), fx-50F Plus (II), and fx-5800P with little to no adjustments.  


7000G Retro Month takes place every Saturday during June 2021.


To make text easier to type, I can going to use the following text friendly symbols for the following:


->  for →


/I for ⊿


=> for ⇒


What do you think?   Unicode or simple text equivalents?  


- - - - - - -- - -- - -


Today's subject revolves around Graphics.  Enjoy!


- - - -- - - -- - -- -- -


Get a emulator or graphing calculator to see the results.


Quadratic Fit by Two Roots


Given two roots A and B, the program generates a quadratic equation and it's graph.   The program assumes that the vertex is a minimum.


Y = (X - A) (X - B)


"ROOT1" -> A

"ROOT2" -> B

"Y = X^2 - " /I

A+B /I

"X + " /I

AB /I

Cls

Graph Y=(X-A)(X-B)


Polar Plotting (Self Contained)


I usually use Radians (Mode 5 for fx-7000G, fx-7500G, fx-6300G) angle mode when it comes to graphics and calculus.  To set/change each equation, you will need to edit the program here.  I state the equation to be in the form r(T) where T = θ.  


On the Rec command, x is stored to I and y is stored to J.  (specific to fx-7000G, fx-7500G, fx-6300G)


"POLAR R(T)"

Rad

"RMIN"? -> A

"RMAX"? -> B

"N"? -> N

(B-A)÷N -> H

A-H -> T

Cls

Lbl 1

T+H -> T

[insert r(T) here]

Rec(Ans, T)

Plot I,J

T<B => Goto 1


Cubic Bezier Curve


This program plots a cubic Bezier curve with the following variables:


(x0, y0):  A = A[0], B = A[1]  (exact fit)

(x1, y1):  C = A[2], D = A[3]

(x2, y2):  E = A[4], F = A[5]

(x3, y3):  G = A[6], H = A[7]   (exact fit)


Cls

0 -> I

"CUBIC BEZIER"

Lbl 1

"X"? -> A[ I ]

Isz I

"Y"? -> A[ I ]

Isz I

I < 8 => Goto 1

0 -> T

Lbl 2

A(1-T)^3 + 3C(1-T)^2 T + 3E(1-T) T^2 + GT^3 -> X

B(1-T)^3 + 3D(1-T)^2 T + 3F(1-T) T^2 + HT^3 -> Y

Plot X,Y

T+.02 -> T

T<1 => Goto 2


Press [ G<>T ] to see the graph.  


Polygon Drawing


The programs allow the user to draw many lines in a row by connecting points.   The original point are stored in variables E and F.   To complete the polygon, use (E, F) as the final point.  


The prompt MORE:  enter 0 to stop, anything else to continue connecting points


Cls

"X0"? -> A : A -> E

"Y0"? -> B : B -> F

Plot A,B

Lbl 1

"ORIG (E,F)"

"NEXT X"? -> C

"NEXT Y"? -> D

0 -> T

Lbl 2

(1-T)A+CT -> X

(1-T)B+DT -> Y

Plot X,Y

T+.02->T

T<1 => Goto 2

C -> A : D -> B

"MORE"? -> M

M≠0 => Goto 1


Drawing an Ellipse


This program draws an ellipse.  


"ELLIPSE"

"X RADIUS"? -> A

"Y RADIUS"? -> B

Rad

Cls

Range -A-.5,A+.5,(2A+1)÷20,-B-.5,B+.5,(2B+1)÷20

0 -> T

Lbl 1

Plot A cos T, B sin T

T+2π÷64 -> T

T<2π => Goto 1


Press [ G<>T ] to see the graph.  


Eddie


All original content copyright, © 2011-2021.  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, February 1, 2020

TI-59: Geometric Areas

TI-59: Geometric Areas



Introduction

The program calculates areas of planar geometric shapes.  The following user keys are defined:

A:  Enter A or radius.

B:  Enter B

C:  Enter C

D:  Display the total area

E:  Clear the total area

A':  Calculate the area of an Ellipse:  π*A*B.  For a circle, A = B

B':  Calculate the area of a Rectangle:  A*B.  For a square, A = B

C':  Calculate the area of a Triangle using Heron's Formula. 
S = (A + B + C)/2; √(S * (S - A) * (S - B) * (S - C))

D':  Calculate the area of Sector of a Circle:  π*B°*A^2/360
A:  radius, B: angle in degrees

E':  Calculate the area of a Regular Polygon:  (B * A^2)/(4 * tan(180°/B))
A:  length of a side, B:  number of sides (degrees)

Each calculation will add to the total area.

Memory Registers:

R01:  A
R02:  B
R03:  C
R04:  total area
R05:  S = (A + B + C)/2

The program is for the TI-58C, TI-58, TI-59, their emulators, and TI-66.

TI-59 Program:  Geometry Areas

000 76 LBL
001 11 A
002 42 STO
003 01 01
004 91 R/S
005 76 LBL
006 12 B
007 42 STO
008 02 02
009 91 R/S
010 76 LBL
011 13 C
012 42 STO
013 03 03
014 91 R/S
015 76 LBL
016 14 D
017 43 RCL
018 04 04
019 91 R/S
020 76 LBL
021 15 E
022 25 CLR
023 42 STO
024 04 04
025 91 R/S
026 76 LBL
027 16 A'
028 89 PI
029 65 *
030 43 RCL
031 01 01
032 65 *
033 43 RCL
034 02 02
035 95 =
036 44 SUM
037 04 04
038 91 R/S
039 76 LBL
040 17 B'
041 43 RCL
042 01 01
043 65 *
044 43 RCL
045 02 02
046 95 =
047 44 SUM
048 04 04
049 91 R/S
050 76 LBL
051 18 C'
052 53 (
053 43 RCL
054 01 01
055 85 +
056 43 RCL
057 02 02
058 85 +
059 43 RCL
060 03 03
061 54 )
062 55 /
063 02 2
064 95 =
065 42 STO
066 05 05
067 65 *
068 53 (
069 43 RCL
070 05 05
071 75 -
072 43 RCL
073 01 01
074 54 )
075 65 *
076 53 (
077 43 RCL
078 05 05
079 75 -
080 43 RCL
081 02 02
082 54 )
083 65 *
084 53 (
085 43 RCL
086 05 05
087 75 -
088 43 RCL
089 03 03
090 54 )
091 95 =
092 34 SQRT
093 44 SUM
094 04 04
095 91 R/S
096 76 LBL
097 19 D'
098 60 DEG
099 89 PI
100 65 *
101 43 RCL
102 02 02
103 65 *
104 43 RCL
105 01 01
106 33 X²
107 55 /
108 03 3
109 06 6
110 00 0
111 95 =
112 44 SUM
113 04 04
114 91 R/S
115 76 LBL
116 10 E'
117 53 (
118 01 1
119 08 8
120 00 0
121 55 /
122 43 RCL
123 02 02
124 54 )
125 60 DEG
126 30 TAN
127 65 *
128 04 4
129 95 =
130 35 1/X
131 65 *
132 43 RCL
133 02 02
134 65 *
135 43 RCL
136 01 01
137 33 X²
138 95 =
139 44 SUM
140 04 04
141 91 R/S

Example

5 [ A ]  6 [  B ]

[2nd] [ A' ]   Result:  94.24777961  (area of an ellipse with A = 5, B = 6)

[2nd] [ B' ]  Result:  30  (area of a rectangle with A = 5, B = 6)

9 [ C ]

[2nd] [ C' ]  Result: 14.14213562  (area of a triangle with A = 5, B = 6, C = 9)

9 [ A ] 60 [ B ]

[2nd] [ D' ]  Result: 42.41150082 (area of a circular sector A = 9, B = 60°)

9 [ A ] 8 [ B ]

[2nd] [ E' ]  Result:  391.1025971 (area of a polygon with a side length of 9 and 8 sides)

[ D ]  Total Area:  571.9040132

[ E ] clears total area

Eddie

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

Sharp EL-5200/EL-9000 AER II Program Collection – September 2026

Sharp EL-5200/EL-9000 AER II Program Collection – September 2026 For my review on the Sharp EL-5200 (also known as the Sharp EL-9000)...