Showing posts with label forward intersection. Show all posts
Showing posts with label forward intersection. Show all posts

Thursday, November 24, 2016

Casio fx-7400g Plus: Program Library

Casio fx-7400g Plus: Program Library


Contents:
* Polar Graphing (POLAR)
* Summation and Integration (FX, SUMFX, INTFX)
* Binomial Expansion (BINOMEXP)
* Forward Triangle Intersection (FORDINT)
* Coordinates of a Traverse (TRAVEZ)
* Quadratic Equation (QUAD)


The classic fx-7400g (we’re talking about the early 2000s) lacked numerical integration, summation, and polar graphing.  Let’s remedy that through programming.

Fortunately any of the programs created on the fx-7400g Plus can be translated literally to later Casio graphing calculators. 


Casio fx-7400g Plus Program POLAR
  
Program POLAR
ClrGraph
Rad
“THETA MIN”? → A
“THETA MAX”? → B
“THETA STEP”? → S
For A → I To B Step S
sin (2I) →  R       (see note below)
PlotOn R cos I, R sin I
Next
DrawGraph

Notes:
*  This is best used when the function list is clear.
*  Set up graph screen parameters (Xmin, Xmax, Ymin, Ymax) before hand.
*  Insert polar functions by editing the 7th line (in italics), using I for θ.  The result must be stored to R  (by → R).

Casio fx-7400g Plus Programs FX, SUMFX, INTFX

The programs SUMFX and INTFX will require the subroutine program FX.  FX is where you insert the function f(x).   The result is stored to Y. 

Program FX
X^2+1 → Y
Return

Program SUMFX
“LOWER”? → L
“UPPER”? → U
0 → T
For L → X To U
Prog “FX”
T + Y → T
Next
“SUM=”
T

Example:  FX contains X^2 +1, with L = 1, U = 15.  Result:  1255
Program INTFX
“LOWER”? → L
“UPPER”? → U
“NO. PARTS”? → N
Rad
L → X
Prog “FX”
Y → T
U → X
Prog “FX”
T + Y → T
(U – L) ÷ N → H
For 1 → I To N-1
L + I * H → X
Prog “FX”
If I Rmdr 2 = 0
Then T + 2*Y → T
Else T + 4*Y → T
IfEnd
Next
T * H ÷ 3 → T
“INTEGRAL=”
T

Example:  FX contains X^2 +1, with L = 1, U = 15, N = 24.  Result:  1138.666667

Casio fx-7400g Plus Program BINOMEXP

The program BINOMEXP shows the coefficients of the binomial expansion (Ax + B)^N.

Program BINOMEXP
“(AX+B)^N”
“A”? → A
“B”? → B
“N”? → N
For 0 → I To N
N nCr I * A^(N-I) * B^I → T
“{COEF, POWER}”
{T, N-I}
Next

Example:  (2x – 3)^2
Results:  {4, 2}, {-12, 1}, {9, 0}   (4x^2 – 12x + 9)


 Casio fx-7400g Plus Program FORDINT

The program FORDINT calculates the third point on a triangle where the coordinates of points A  (xa, xb) and B (xb, yb) are known.  Also, a line towards P point is aimed from point A at angle α° and from point B at angle β°. 

Variable
Casio fx-7400g Plus
Variable
Casio fx-7400g Plus
Variable
Casio fx-7400g Plus
xa
N
ya
S
α
A
xb
O
yb
T
β
B
xp
P
yc
U
γ
C


Source: Casio.   Casio fx-FD10 Pro User’s Guide Tokyo. 2014

Program FORDINT
Deg
“XA”? → N
“YA”? → S
“ANGLE A”? → A
“XB”? → O
“YB”? → T
“ANGLE B”? → B
1 ÷ tan A + 1 ÷ tan B → C
(N ÷ tan B + O ÷ tan A + (T – S)) → P
(S ÷ tan B + T ÷ tan A + (N – O)) → U
180 – A – B → C
“{XP, YP, C}”
P
U
C

Example:
Point A:  (1000, 950), angle towards point P:  30°
Point B:  (1012, 997), angle towards point P:  44°

Result:
Point P:  (approximately) (1024.49237, 975.078358)
Angle γ: 106°

Casio fx-7400g Plus Program TRAVEZ

TRAVEZ calculates the new point knowing the original coordinates, direction, and angle of travel.  The angle 0° comes from due east and rotates counterclockwise.

Program TRAVEZ
Deg
“1ST EAST”? → E
“1ST NORTH”? → N
0 → D
Lbl 1
“DISTANCE”? → I
“ANGLE”? → A
I * cos A + E → E
I * sin A + N → N
D + I → D
“POINT”
{E, N}
“DONE? Y=1”
? → Y
Y ≠ 1 Goto 1
“DISTANCE =”
D

Example:  Initial point (1000,1000)
Distance: 750, Angle:  276; Point {1078.396347, 254.1085785}
Distance: 600, Angle:  35; Point {1569.887574, 598.2544403}
Distance: 700, Angle:  118; Point {1241.25748, 1216.317755}
Total Distance:  2050

Casio fx-7400g Plus Program QUAD

The program QUAD is the quadratic equation which finds the roots of

Ax^2 + Bx + C = 0

Yes, I just can’t resist.

Program QUAD
“A”? → A
“B”? → B
“C”? → C
B^2 – 4AC → D
If D≥0
Then “REAL ROOTS”
(-B + √D) ÷ (2A) → S
(-B - √D) ÷ (2A) → T
Else “ROOTS S+TI”
-B ÷ (2A) → S
√(Abs D) ÷ (2A) → T
IfEnd
{S, T}


Example:
A = 2.5, B = -3, C = -1.1
Roots:  “REAL ROOTS”, 1.494427191, -0.294427191


A = 2.5, B = -3, C = -1.1
Roots:  “ROOTS S+TI”,  -0.375 ± .3665719575i   (T:  -3.665719575)

Happy Thanksgiving!  Eddie


This blog is property of Edward Shore, 2016.





Thursday, November 17, 2016

HP Prime and TI-84 Plus: Forward Intersection

HP Prime and TI-84 Plus:  Forward Intersection

Introduction

The program FORDINT calculates the third point on a triangle where the coordinates of points A  (xa, xb) and B (xb, yb) are known.  Also, a line towards P point is aimed from point A at angle α° and from point B at angle β°.  See the diagram below.



Formulas:

Output is point P:
xp = (xa cot β + xb cot α + (yb – ya))/(cot α + cot β)
yp = (ya cot β + yb cot α + (xa - xb))/(cot α + cot β)
γ = 180° - α - β

cot θ  = 1/tan θ

Note that FORDINT will set the calculator to Degrees mode.



HP Prime Program FORDINT

Input:  xa, ya, α, xb, yb, β
Output:  3 element list:  {xp, yp, γ} and Degrees mode is set

EXPORT FORDINT(xa,ya,a,xb,yb,b)
BEGIN
// Forward Intersection
// 2016-11-16 EWS

LOCAL xp,yp,c;
// Degree Mode
HAngle:=1;
// Calculation
xp:=(xa*COT(b)+xb*COT(a)+(yb-ya))
/(COT(a)+COT(b));
yp:=(ya*COT(b)+yb*COT(a)+(xa-xb))
/(COT(a)+COT(b));
c:=180-a-b;
RETURN {xp,yp,c};
END;


TI-84 Plus Program:  FORDINT

Input:  Variables are prompted
Output:  Results are displayed 

Variable
TI-84 Plus Variable
Variable
TI-84 Plus Variable
Variable
TI-84 Plus Variable
xa
N
ya
S
α
A
xb
O
yb
T
β
B
xp
P
yc
U
γ
C

"FORWARD INTERSECT"
"2016-11-16 EWS"
Degree
Input "XA: ",N
Input "YA: ",S
Input "θA: ",A
Input "XB: ",O
Input "YB: ",T
Input "θB: ",B
(N/tan(B)+O/tan(A)+(T-S))/(1/(tan(A))+1/(tan(B)))→P
(S/tan(B)+T/tan(A)+(N-O))/(1/(tan(A))+1/(tan(B)))→U
180-A-B→C
Disp "XP: ",P
Disp "YP: ",U
Disp "θC: ",C

Example:
Point A:  (1000, 950), angle towards point P:  30°
Point B:  (1012, 997), angle towards point P:  44°

Result:
Point P:  (approximately) (1024.49237, 975.078358)
Angle γ: 106°

Source: Casio.   Casio fx-FD10 Pro User’s Guide Tokyo. 2014

This blog is property of Edward Shore, 2016.


HP 48G Collection

 HP 48G Collection  Contents:  Intensity of Spherical Light Source  Speed of Light in Dry Air  Pressure of Air  Earth's Gravity a...