Sunday, October 6, 2019

Fun with the TI-81: Part II

Fun with the TI-81:  Part II

Please check out yesterday's blog entry for Part I.  Now let's continue.

TI-81 Decimal to Fraction:  DECTOFRAC
(148 bytes)

This program converts a number X to fraction as an approximation.  Each successful approximation is displayed until the absolute value of the error falls below 10^-12.  This program is based on a program written for the Radio Shack TRS-80 (see source). 

Variables:
X = Number
H = numerator
I = denominator
Y = error
Used: A, B, C, D, E, F, G, J

Program:
Disp "X="
Input X
IPart X → A
1 → B
X - A → C
0 → D
1 → E
1 → F
0 → G
Lbl 2
A * F + D → H
A * G + E → I
H / I - X → Y
ClrHome
Disp H
Disp "/"
Disp I 
Disp "ERR="
Disp Y
Pause
If abs Y<1e-12 font="">
Stop
C → J
B - A * C → C
J → B
F → D
H → F
G → E 
I → G
Goto 2

Example:
X = 4.7995
4 / 1,  ERR = -.7995
5 / 1,  ERR = .2005
13 / 4, ERR = -.0495
24 / 5,  ERR = 5E-4
1915 / 399, ERR = -1.253133E-6
9599 / 2000, ERR = 0

4.7995 = 9599/2000

Source:

Craig, John Clark  119 Practical Programs for the TRS-80 Pocket Computer  Tabs Books Inc.:  Blue Ridge, PA.  1982 ISBN 0-8306-0061-1 (Paperback)

TI-81 Simple Logistic Regression:  LOGISFIT 
(71 bytes)

The program LOGISFIT fits the statistical data to the equation:

y = 1 / (a + b*e^x)

This program uses the linear regression fit with the following translations:

x' = e^(-x), y' = 1/y

This fit will is good for all data except when y = 0.

Instructions: 
1.  Enter the data through the Stat Edit menu. 
2.  Run LOGISFIT.  The data will be altered. 

Program:
1 → I
Lbl 1
e^( -{x}(I) ) → {x}(I)
{y}(I)⁻¹ → {y}(I)
IS>( I, Dim{x} )
Goto 1
LinReg
Disp "Y=1/(a+be^(X))"
Disp "a"
Disp a
Disp "b"
Disp b

Example:
x1 = 0.5
y1 = 0.384
x2 = 1
y2 = 0.422
x3 = 1.5
y3 = 0.45
x4 = 2
y4 = .468
x5 = 2.5
y5 = .48

Results:
a = 2.001859259
b = .9942654005

Equation:
y = 1 / (2.001859259 + .9942654005*e^x)

Source:

Shore, Edward.  "HP Prime and TI-84 Plus CE: Simple Logistic Regression"  Eddie's Math and Calculator Blog. 2017.  http://edspi31415.blogspot.com/2017/04/hp-prime-and-ti-84-plus-ce-simple.html
Retrieved August 17, 2019

TI -81 Confidence Intervals: INTERVAL
(184 bytes)

The program INTERVAL calculates a confidence interval given the sample's mean (M), variance (V), and number of data points (N).  A Z scored is selected when the user selects one of three confidence levels: 

99%  (0.5% on each side of the curve, Z = 2.575829586)
95%  (2.5% on each side of the curve, Z = 1.959963986)
90%.  (5% on each side of the curve, Z = 1.644853627)

The interval lies between ( M - Z * V/√N,  M + Z * V/√N )

Notes:
1.  Z is used as an control variable and the Z score.
2.  The percent symbol is built of three characters, the degree symbol (°), the forward slash by pressing the [ ÷ ] key (/), the decimal point (.).

Program:
0 → Z
Disp "MEAN="
Input M
Disp "VAR="
Input V
Disp "N="
Input N
Lbl 0
ClrHome
Disp "1. 99°/."
Disp "2. 95°/."
Disp "3. 90°/."
Input P
If P=1
2.575829586 → Z
If P=2
1.959963986 → Z
If P=3
1.644853627 → Z
If Z=0
Goto 0
M + Z * V / √N → U
M - Z * V / √N → V
Disp "INTERVAL"
Disp U
Disp V

Example:
Input:  n = 100, M = 156.39, V = 10.94, 99% confidence interval
Results: 
162.2079576
156.5720424

Source:
Kelly, Kathy A., Robert E. Whitsitt II, M. Deal LaMont, Dr. Ralph A. Olivia, et all.  Scientific Calculator Sourcebook   Texas Instruments Inc.  1981.  (no ISBN number is given)

TI-81 Fresnel Polarization:  MICROPOL
(120 bytes)

Given a microwave transferring from one medium to another with the initial angle with respect to the plane surface that separates the mediums, the following are calculated:

1.  Angle of refraction, θt
2.  Fresnel Horizontal Polarization, R_H
3.  Fresnel Vertical Polarization, R_V

The Law of Refraction:
n1 sin θi = n2 sin θt

Fresnel Horizontal Polarization:
R_H = sin(θ_i - θ_t) / sin(θ_i + θ_t)

Fresnel Vertical Polarization:
R_V = tan(θ_i - θ_t) / tan(θ_i + θ_t)

Variables:
N = n_1  (index of refraction of medium 1)
M = n_2  (index of refraction of medium 2)
θ = θ_i  (angle of incidence)
Z = θ_t (angle of refraction)
H = R_H (Fresnel horizontal polarization)
V = R_V (Fresnel vertical polarization)

Note:  Angles are in degrees

Program:
Deg
Disp "N1="
Input N
Disp "θ="
Input θ
Disp "N2="
Input M
sin⁻¹ (Nsin θ / M) → Z
sin(θ-Z) / sin(θ+Z) → H 
tan (θ-Z) / tan (θ+Z) → V
Disp "REFRACT θ=" 
Disp Z
Disp "H-POLAR="
Disp H
Disp "V-POLAR="
Disp V

Example:
Inputs:  N1 = 1.001, θ = 40°, N2 = 1.333
Results:
REFRACT θ = 28.86146514°
H-POLAR = .2071186671
V-POLAR = .0761259908

Source:
Barue, Geraud  Microwave Engineering:  Land & Space Communications  John Wiley & Sons: Hoboken, NJ 2008.  ISBN 978-0-470-08996-5

TI-81 Hyperbolic Circles: Circumference and Area:  HYPCIRCL
(61 bytes)

The program HYPCIRCL calculates the circumference and area of a circle in hyperbolic space.  Note that this not the same as (normal, regular, everyday) circles in Euclidean space. 

Circumference of a hyperbolic circle: C = 2 π sinh(R)

Area of a hyperbolic circle:  A = 4 π sinh(R/2)^2

Program:
Disp "HYP CIRCLE"
Disp "R="
Input R
2π sinh R → C
4 π (sinh(R/2))² → A
Disp "C="
Disp C
Disp "A="
Disp A

Example:
Input: R = 3
Results: 
C = 62.94416455
A = 56.97380062

Source:
Series, Caroline  "Hyperbolic Geometry MA 448"  2010. Edited Jan. 4, 2013

Eddie

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