## Saturday, May 19, 2018

### Update to the Big Font Math Reference

Original post:  https://edspi31415.blogspot.com/2018/04/april-11-2018-seven-years.html

I added several sections to the Big Math Reference document, which you can download on the right side of the blog.

What is added:

* Days Between Dates Algorithm
*  Astronomy Formulas: Kepler's 3rd Law, Parallax, Luminosity, Schwartzchild Radius
*  Physics:  Projectile Motion, Linear Motion, Angular Motion
*  Electronics:  Ohm's Law, Resistance

Eddie

### Calculus/TI-84 Plus CE: Derivatives of kth Order

Calculus/TI-84 Plus CE:  Derivatives of Kth Order

Introduction

Can we find a general formula for a derivative of nth order?

d^n/dx^n f(x) = ?

The Power Function x^n

From calculus, we find that:

f(x) = x^n

d/dx x^n = n * x^(n - 1)

d^2/dx^2 x^n = n * (n – 1) * x^(n – 2)

d^3/dx^3 x^n = n * (n – 1) * (n – 2) * x^(n – 3)

d^4/dx^4 x^n = n * (n – 1) * (n – 2) * (n – 3) * x^(n – 4)

Note that for order k,

d^k/dx^k x^n = (n * (n – 1) * (n – 2) * (n – 3) * … * (n – (k – 1)) ) * x^(n – k)

d^k/dx^k x^n = (n * (n-1) * (n-2) * … * 1)/((n-k) * (n-k-1) * … * 1) * x^(n – k)

d^k/dx^k x^n = n! / (n – k)! * x^(n – k)

With the gamma function property Γ(z + 1) = z!,

d^k/dx^k x^n = Γ(n + 1)/Γ(n – k + 1) * x^(n – k)

The above formula allows us to calculate the kth derivative of x^n, even when k is not an integer.

TI-84 Plus CE Program NDERPOW

"2018-05-18 EWS"
Disp "D^K/DX^K X^N"
Input "POWER (N):",N
Input "VALUE    :",A
Input "ORDER (K):",K
If N≥K
Then
N!/(N-K)!*A^(N-K)→D
Else
0→D
End
Disp D

The program NDERPOW calculates the numerical derivative of d^k/dx^k x^n.  For this particular program, k must be an integer since non-integers are not accepted on the TI-84 Plus’ factorial function.

The Exponential Function e^(a*x), where a is a constant

f(x) = e^(a*x)

d/dx e^(a*x) = a * e^(a*x)

d^2/dx^2 e^(a*x) = a^2 * e^(a*x)

d^3/dx^3 e^(a*x) = a^3 * e^(a*x)

d^4/dx^4 e^(a*x) = a^4 * e^(a*x)

With the order k…

d^k/dx^k e^(a*x) = a^k * e^(a*x)

Just like the last case, k does not have be an integer.

TI-84 Plus CE Program NDEREXP

"2015-05-18 EWS"
Disp "D^K/DX^K e^(A*X)"
Input "COEFF (A):",A
Input "VALUE    :",X
Input "ORDER (K):",K
A^K*e^(A*X)→D
Disp D

The program NDEREXP calculates the numerical derivative of d^k/dx^k e^(a*x).

The Sine Function sin(a*x) and the Cosine Function cos(a*x)

We are working radian angle measure.

f(x) = sin(a*x)

d/dx sin(a*x) = a * cos(a*x)

d^2/dx^2 sin(a*x) = -a^2 * sin(a*x)

d^3/dx^3 sin(a*x) = -a^3 * cos(a*x)

d^4/dx^4 sin(a*x) = a^4 * sin(a*x)

Notice a pattern, alternating between sin and cos.  To the kth order (k is an integer),

d^k/dx^k sin(a*x) =

(-1)^int(k/2) * a^k * cos(a*x), when k is odd

(-1)^int(k/2) * a^k * sin(a*x), when k is even

If we put the piecewise function into one statement:

d^k/dx^k sin(a*x) = (-1)^int(k/2) * a^k * ( 2*frac(k/2)*cos(a*x) + 2*frac((k+1)/2)*sin(a*x) )

Note that:

2 * frac(k/2) = 1 for all odd integers k, 0 for all even integers k

Likewise, 2 * frac((k + 1)/2) = 0 for all odd integers k, 1 for all even integers k

And, (-1)^int(k/2) produces a pattern of 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, …

TI-84 Plus CE Program NDERSIN

"2018-05-19 EWS"
Disp "D^K/DX^K sin(A*X)"
Radian
Input "COEFF (A):",A
Input "VALUE    :",X
Input "ORDER (K):",K
(­1)^iPart(K/2)*A^K*(2*fPart(K/2)*cos(A*X)+2*fPart((K+1)/2)*sin(A*X))→D
Disp D

Similarly,

f(x) = cos(a*x)

d/dx cos(a*x) = -a * sin(a*x)

d^2/dx^2 cos(a*x) = -a^2 * cos(a*x)

d^3/dx^3 cos(a*x) = a^3 * sin(a*x)

d^4/dx^4 cos(a*x) = a^4 * cos(a*x)

Likewise:

Notice a pattern, alternating between sin and cos.  To the kth order (k is an integer),

d^k/dx^k sin(a*x) =

(-1)^int(k/2 + 1/2) * a^k * sin(a*x), when k is odd

(-1)^int(k/2 + 1/2) * a^k * cos(a*x), when k is even

If we put the piecewise function into one statement:

d^k/dx^k cos(a*x) = (-1)^int(k/2 + 1/2) * a^k * ( 2*frac(k/2)*sin(a*x) + 2*frac((k+1)/2)*cos(a*x) )

TI-84 Plus CE Program NDERCOS

"2018-05-19 EWS"
Disp "D^K/DX^K cos(A*X)"
Radian
Input "COEFF (A):",A
Input "VALUE    :",X
Input "ORDER (K):",K
(­1)^iPart((K+1)/2)*A^K*(2*fPart(K/2)*sin(A*X)+2*fPart((K+1)/2)*cos(A*X))→D
Disp D

NDERSIN and NDERCOS are numeric derivatives for sine and cosine, respectively.  Note for NDERSIN and NDERCOS, the calculator is set to Radian mode, and K (order) should be an integer.

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

## Saturday, May 12, 2018

### Retro Review Casio fx-702P

Retro Review Casio fx-702P

General Information

Company:  Casio
Type:  Scientific, BASIC Programmable
Memory:  26 memory registers, can be expanded to 226 memory registers;
1,680 programming steps maximum
Battery:  2 x CR 2032
Years:  1981 - 1984
Original Cost: approximately \$200 (from the research I could gather)
Display:  20 characters with a contrast wheel

I picked up a Casio fx-702P at a local monthly swap meet in Pasadena, which came along with a Casio FX-2 cassette interface and a FP-10 printer.  Not bad for \$15, which normally this would sell anywhere from \$80 to \$150 on eBay.

My review will focus on the calculator.

Features

The Casio fx-702P is a landscape BASIC programmable calculator designed for storing up to 10 programs.  The maximum amount of steps allocated is 1,680; which seem quite small compared to today’s computers.

The set of scientific functions is nice: hyperbolic functions, linear regression (in the form of y = a + b*x), sign function, integer and fraction parts.

Programs on the fx-702P can be printed using the FP-10 printer.  As of this review I have yet to test the printer, other than providing it with four AA batters, the printer does turn on.  Programs can also be stored to cassette tapes via the FX-2.  I am assuming the connectors on the FX-2 can be connected to any compatible cassette recorder.

The Programming Language

What I find unique about the programming language of the Casio fx-702P is the language.  A lot of the commands are three characters, for example:

 Command usually used in BASIC Casio fx-702P command INPUT INP GOSUB GSB PRINT PRT RETURN RET SQRT SQR ASIN ASN

The DMS allows results to be displayed in a degrees°minutesseconds” format.  DEG(degrees, minutes, seconds) converts DMS to decimal.

A nice command is the SET command, where you can set the number of decimal places to be displayed.  For example SET F4 sets the calculator to FIX 4 mode.

Changing the angle measurement is interesting, you have to type in MODE and the specific number: MODE 4 for degrees, MODE 5 for radians, and MODE 6 for gradients.

Subroutines can work within and between programs.

Arrays and lists can be used, however, they come at an expense of an already low amount of programming steps.  There is only one array and list name, which is A.  A(i) first maps to the other one-letter variable names B-Z first.

What surprises me the most is the lack of ROM or RAM cards for the fx-702P.  There is no way to expand the number of steps on the fx-702P.

Keyboard

On the surface, the Casio fx-702P looks like a good, clean keyboard.  The keys are pretty responsive.  The F1 (red) and F2 (blue) shift keys have a nice contrast.

However, with the batteries I used, which were purchased from a swap meet, the calculator only lasted a couple days (total use I estimate to be an hour in those days) before the display went blank and the keys became unresponsive. Fortunately, using brand name batteries, like Duracell provides better and steady results.

Verdict

The Casio fx-702P is a good programming calculator and I understand why it is highly sought.  If you want to own one, I would look for the best price.

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

### HP Prime: Solving Projectile Motion with the Solve App

HP Prime:  Solving Projectile Motion with the Solve App

This blog entry is a demonstration using the Solve App to solve a variety of problems regarding projectile motion.

Getting Started

Go to the Solver App by pressing [Apps] and selecting the Solve application.  If need be, clear all the equations by pressing [Shift] [ Esc ] and selecting (OK) at the Clear All Expressions prompt.

Enter the following equations:

E1:  X = V*COS(θ)*T
E2:  Y = V*SIN(θ)*T – 0.5*G*T^2

Variables:

X = distance in the x direction
Y = distance in the y direction
Θ = angle the projectile is shot
V = initial velocity
T = number of seconds
G = Earth’s gravitation constant:  9.80665 m/s^2, 32.174 ft/s^2

Right now, we are assuming that there is no acceleration in the X direction, the projectile starts at point (0,0), and there is no air resistance.

Finally, put the calculator in Degrees mode, which the angle indicator will display °.

Example 1:  Determining Distance and Time it takes for the Projectile to complete

Given the following data:

θ = 40°
G = 9.80665 m/s^2
V = 35 m/s
Y = 0

Select X and T to solve.  Pressing (Solve) will give the following results:

X = 0 and T = 0.  Well, that went well.  We have an obvious answer.  What we are looking for is the distance traveled after the projectile has been shot.  Fortunately, the HP Solve app allows us to provide initial guesses.

Let’s put an initial guess of T = 100 and press (Solve) again.  We now get the following results:

X = 123.017492971
T = 4.58822662969

The projectile will travel approximately 123 m in the x direction and it will take slightly after four and half seconds before impact.

Example 2:  Determining initial velocity (V) and angle (θ)

Given the following data:

X = 125.15 m
Y = 3.10896 m
T = 5 s
G = 9.80665 m/s^2 (SI units are used)

The projectile landed on a hill 125.15 m away with an elevation 3.10896 m (10.2 ft) higher than the starting point.

You can clear the data variables with [Shift] [Esc].  Since you are solving for V and θ this time, make sure only those variables are checked.

Select θ, give it an initial value of 0, and press (Solve).

The results are:

θ = 45.1238194711
V = 35.474510698

Example 3:  Hitting a Moving Target

Find the required initial velocity (V) to land a projectile on a wagon moving at rate of 7.33 ft/s.  The wagon is 5.5 ft high.  The wagon is 20 ft away when the projectile is shot.  Assume the projectile is shot at 30°.

The first step is to modify equation E1.  Since the X distance contains a moving object, adjust the left side to 20 + 10*T.   20 for the initial distance plus 10*T for the moving wagon.

The equations will be set as such:

E1:   20+10*T = V*COS(θ)*T
E2:   Y = V*SIN(θ)*T – 0.5*G*T^2

Next enter the following variables:

θ = 30
Y = 5.5 (height of the wagon)
G = 32.174 (we are using US units)

Note that there only five variables this time.  Select V and T to solve for.  We want T selected because we don’t know what T is.

Select T and enter 1 as an initial guess (actually, we really want a small positive number should do it, as long as T is not zero).  .

We get a solution of:

T = 0.818269246898
V = 39.7700027103

This means we should fire the projectile at about 39.77 ft/s and it will land on the wagon.

Example 4:  The Maximum Height of a Projectile

What is the maximum height of a projectile found for a projectile shot at 36° at 54 ft/s?  How far (horizontal distance) does the projectile would have traveled to get that point?

For this problem, we are going to use three equations but they will be solved separately.  Set the equations as such:

E1:  X = V*COS(θ)*T
E2:  Y = V*SIN(θ)*T – 0.5*G*T^2
E3:  0 = V*SIN(θ) – G*T

The projectile reaches its height when the rate of the change in the y direction is 0.  In calculus terms, when Y’(T) = 0 where Y’(T) = dY/dT = V*SIN(θ) – G*T.

On the Symb screen, select only E3.  Press [Num] and enter the variables:

V = 54
θ = 36
G = 32.174 (ft/s^2)

Solve for T.  The result is: T = 0.76305137487.

It takes the projectile about 0.7630 seconds for the projectile to reach its height.

The next step is press [Symb] and select the equations E1 and E2.  Now press [Num], select X and Y to solve for and press (Solve).

The solution is:

X = 43.0981662447
Y = 15.6563253279

The distance is about 43.0982 ft and the height is 15.6563 ft.

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

## Friday, May 11, 2018

### Fun with the Sharp EL-5500 III (May 2018 Edition)

Fun with the Sharp EL-5500 III   (May 2018 Edition)

The EL-5500 III is one of my favorite pocket programming device, small, portable, and has my favorite programming language: BASIC.

Let’s get started.

Note:  Substitute line numbers with labels that you find fit.  Add defined labels to the first line if you would like.  Labels can come from the bottom two rows of the QWERTY keyboard (A row and Z row).

Comments are followed by double slashes (//), they are not typed.

Sharp EL-5500 III Program:  Net Present Value

2  PAUSE “NET PRESEN VALUE”
4  CLEAR    // clears all the variables
6  INPUT “CF0:”; N, “RATE:”; I
8  J = 1
10 INPUT “FLOW:”; F, “FREQ:”; K
12 FOR L=1 TO K: N = N + F/(1 + I/100)^J: J = J+1
14 NEXT L
16 INPUT “MORE=1: “; L   // enter 1 to enter more cash flows, anything else to end entry
18 PRINT USING “#############.##”; “NPV: “; N
20 END

Example:

CF0:  -7,000,  Interest Rate:  8%
Flow 1:  2,000, Freq 1: 1  (enter 1 for MORE)
Flow 2:  1,500, Freq 2: 2  (enter 1 for MORE)
Flow 3:  2,500, Freq 3: 2  (we are at the end, enter anything other than 1 at MORE)

Result:
NPV:  2443.06

Sharp EL-5500 III Program: Synthetic Division

2 PAUSE “Synthetic Division”: CLEAR
4 PRINT “P(X)/(X – R)”: WAIT 59   // WAIT 59 is about 1 second
6 INPUT “DEGREE:”; N
8 DIM P(N): DIM Q(N)
10 FOR I=1 TO N
12 PRINT “COEF OF X^”; N-I
14 INPUT P(I): Q(I) = P(I)
16 NEXT I   // there is no line 18
20 INPUT “R:”; R
22 FOR I=0 TO N-1
24 Q(I+1) = R*Q(I) + P(I+1)
26 NEXT I
28 E = Q(N)
30 PRINT “Q(X) = “
32 FOR I=0 TO N-1
34 PRINT Q(I); “X^”; N-I-1
36 WAIT 150  // about 2.5 seconds
38 NEXT I
40 PRINT “+”; E; “/(X-“; R; “)”: END

Example:  (x^4 – 2*x^3 + 1) / (x – 1)
Degree: 4
Coefficients:  1, -2, 0, 0, 1
R: 1

Result: 1, -1, -1, -1, no remainder
x^3 – x^2 – x – x

Sharp EL-5500 III Program: Vector Basics

Cross product, dot product, norm of two vectors, angle between two vectors

2 PAUSE “Vector Basics”
4 INPUT “X1:”; X1, “Y1:”; Y1, “Z1:”; Z1  \\ vector 1
6 INPUT “X2:’; X2, “Y2:”; Y2, “Z2:”, Z2  \\ vector 2
8 C1 = Y1*Z2 – Y2*Z1: C2 = -X1*Z2 + X2*Z1: C3 = X1*Y2 – X2*Y1  // cross product
10 D = X1*X2 + Y1*Y2 + Z1*Z2  \\ dot product
12 N1 = √(SQU X1 + SQU Y1 + SQU Z1): N2 = √(SQU X2 + SQU Y2 + SQU Z2)  // norm, SQU is the x^2 key
14 DEGREE
16 A = ACS( D/(N1*N2))  // angle between vectors, ACS is ACOS
18 PRINT “CROSS X: ”; C1
20 PRINT “CROSS Y: ”; C2
22 PRINT “CROSS Z: ”; C3
24 PRINT “DOT: ”; D
26 PRINT “NORM V1: “; N1
28 PRINT “NORM V2: “; N2
30 PRINT “ANGLE: “; A
32 END

Example:  V1 = [-2, 3, 0] and V2 = [ 4, 2, -11]
Cross: [-33, -22, -16]
Dot: -2
Norm V1: 3.605551275
Norm V2: 11.87434209
Angle: 92.67749998°

Sharp EL-5500 III: Atwood Machine

M1:  mass hanging on the left side of the machine
M2:  mass hanging on the right side of the machine

The program asks to choose a unit system.  Enter 1 for US units (feet, pounds, seconds, g = 32.174 ft/s^2), anything else for SI units (meters, kilograms, seconds, g = 9.80665 m/s^2).

2 PAUSE “Atwood Machine”
4 INPUT “1: US, ELSE: SI “; I
6 IF I=1 THEN LET G=32.174
8 IF I<>1 THEN LET G=9.80665
10 INPUT “M1: “; M1, “M2: “; M2
12 A = (M1 – M2)*G / (M1 + M2)
14 T = M1 * (G-A)
16 PRINT “Accel.: “; A
18 PRINT “Tension: “: T
20 END

Example:  M1 = 11.82 kg, M2 = 9.38 kg, use SI units (enter anything other than 1 at the 1:US, ELSE:SI prompt)

Results:
Accel.: 1.128689906 m/s^2
Tension: 102.5734883 N

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

## Thursday, May 10, 2018

### Casio fx-CG 50 OS 3.11 Update

Casio fx-CG 50 OS 3.11 Update

The newest software update for the Casio fx-CG50 is available.  Download page:

What is updated?

According to Casio, the main new feature is the Reset1 command added to the Reset1 which deletes almost everything save several Add-in programs.  For a full list, click here:  https://edu.casio.com/products/graphic/cgreset/

The Italian language is also added.

A small update from 3.10 to 3.11.  To see what version 3.10 updated, click here:

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

### HP Prime: Combined Internal Rate of Return

HP Prime: Combined Internal Rate of Return

Introduction

An investor has several projects, each with their own initial investments and discount rate.  The net present value is calculated (NPV) for each project.  If the investor combined all the projects into one set of cash flows, what is the effective internal rate of return (IRR)?  The program COMBIRR tackles this question.

For example, an investor has the following projects, each lasting five years:

Project A:  NPV:  -\$3,500, discount rate: 10%
Project B:  NPV:  \$18,000, discount rate: 12%
Project C:  NPV:  \$20,000, discount rate: 9%

If the investor combines all three projects, what would be the combined internal rate of return?  I use the following steps:

1. Calculate the NUS (net utility stream) of each project.  Since we are only given the net present value in this case, will need to determine a payment flow.  The NUS calculates the cash flow of each year, assuming they are equal.  Setup:  N = number of years, I/YR = discount rate, PV = -NPV, FV = 0, P/Y = 1.

2.  Combine the present values from each project, along with net utility streams calculated from each project.  Calculate IRR.  Setup:  CF0 = -ΣNPV, Cash Flows = ΣNUS, frequency length of project

This procedure, like the program COMBIRR, assumes that each project has the same length.  With some adjustments, you can calculate combined IRR using projects of the same length.

Going back to our example:

Project A:  NPV:  -\$3,500, discount rate: 10%, NUS: -\$569.61
Project B:  NPV:  \$18,000, discount rate: 12%, NUS: \$3,185.71
Project C:  NPV:  \$20,000, discount rate: 9%, NUS: \$3,116.40

ΣNPV:  \$34,500, ΣNUS:  \$5,732.50

Calculate IRR with CF0 = -34500.00, Cash Flows:  5,732.50 with a frequency of 5

Result:  10.49  (Combined IRR: 10.49%)

How to Run COMBIRR:

1. Enter the length of each of the projects.  COMBIRR assumes each project has the same length.

2.  Enter the NPV and discount RATE for the first project.  Each time the program will ask you “ENTRY?”.  Select YES for additional entries, NO to stop entering amounts.

3.  The combined IRR is calculated.

HP Prime Program: COMBIRR

sub1(); // data subroutine

EXPORT COMBIRR()
BEGIN
// EWS 2018-05-10
// Combined IRR using
// same length projects

// initialize
LOCAL L1,U,T,L,C;
LOCAL h,N,I;

// input
INPUT(L,"Number of Periods",
"LEN: ");

// entry routine
REPEAT
L1:=sub1(); N:=L1(1); I:=L1(2);
T:=T-N;
U:=U+Finance.TvmPMT(L,I,−N,0,1);
CHOOSE(h,"ENTRY?","YES","NO");
UNTIL h==2;

// calculate combined IRR
C:=Finance.CashFlowIRR(
{T,{U,L}},1);
RETURN C;

END;

// data entry subroutine
sub1()
BEGIN
LOCAL x1,x2;
INPUT({x1,x2},"Data Entry",
{"NPV: ","RATE: "});
RETURN {x1,x2};
END;

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

### Update to the Big Font Math Reference

Original post:   https://edspi31415.blogspot.com/2018/04/april-11-2018-seven-years.html I added several sections to the Big Math Referenc...