Thursday, May 30, 2019

HP Prime and HP 17BII: Trapezoid Rule Using Distinct Points

HP Prime and HP 17BII: Trapezoid Rule Using Distinct Points



Introduction

We can estimate the area of any surface by the use of sums and integral.  In calculus, we usually are given a function f(x), but here we are using measurements from one end to the other at various intervals. 

Technically, the intervals between each measurement do not have to be equal length.  However, having intervals of equal length makes things a lot easier, and in this blog entry, we assume they are. 

We have various methods to estimate the area.  One of the easiest ways is the Trapezoid Rule:

Area ≈ h/2 * ( y_1 + y_n + 2 * Σ( y_k , k, 2, n-1 ) )

Where:

h = interval length
y_k = length of each measurement, there are  n measurements
y_1 and y_n:  measurement of lengths at each end, respectively

Another rule to estimate area is the Simpson's Rule:

Area ≈ h/3 ( y_0 + y_n + 4 * Σ( y_k, k, 1, n-1, 2) + 2 * Σ( y_k, k, 2, n-2, 2) )

The program presented here uses the Trapezoid Rule. 

HP Prime Program AREAHGT

Two arguments:  h, a list of measurements

EXPORT AREAHGT(h, ms)
BEGIN
// h:  increment between measurements
// ms: list of measurements
// 2019-05-09 EWS
LOCAL k,n:=SIZE(ms);
RETURN h/2 * (ms(1) + ms(n) + 2 * Σ( ms(k), k, 2, n-1 ));
END;

HP 17BII+ (Silver)/HP 17BII Solver:  Trapezoid Rule

First:  define a SUM list named MS.  The solver uses that list to get the reference measurements.

Solver:

AREAHGT: AREA = 0 * L(N:SIZES(MS)) + H÷2 * (ITEM(MS:1) + ITEM(MS:G(N)) + 2 * Σ(K:2: G(N)-1: 1: ITEM(MS:K) )

Example

h = 0.5

MS:
y_1 = 1174
y_2 = 1078
y_3 = 979
y_4 = 984
y_5 = 810
y_6 = 779
y_7 = 800
y_8 = 852
y_9 = 966

Area:  3676

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.

Monday, May 27, 2019

Fractal Plots: TI-84 Plus CE and HP Prime

Fractal Plots:  TI-84  Plus CE and HP Prime

Introduction

The program CHAOS1 plots a fractal to simulate a Julia Set.  Given the complex numbers z_k and c, repeats the equation:

z_n = z_n-1 + c^2

The program will ask for a sample graphing space with the a border B.  The viewing window will be set up as:

Xmin = -B
Xmax = B
Ymin = -B
Ymax = B

The program CHAOS1 will also as for the number of points (G), this will determine the number of points plotted in the graph.  The higher G is, the more detailed the fractal is; however, the plot will take longer to complete.

We start with each point on the graph z_0 = a + b*i, where i = √-1.  Then we calculate:

z_1 = z_0^2 + c
z_2 = z_1^2 + c
z_3 = z_2^2 + c
and so on.

For each z_0, we have two possibilities for the repeated calculations:

1.  |z_n| = abs(z_n) eventually goes towards infinity or

2.  |z_n| = abs(z_n) eventually settles (or converges) to a specific point.

A color is assigned to each point z_0.  The color is determined by the amount of iterations it takes to reach |z| > 2.  For such points that fit criteria 2, and never reaches |z| >2, the point is colored black.  This method creates the Julia set for any given c.

For the program CHAOS1, I set up a rank of colors to plot each point, and arbitrary pick a maximum amount of iterations.  For example, I picked 9 colors for the TI-84 Plus CE version.  Hence for each point, if |z| ≤ 2 after 9 iterations, color the point black.

Obviously the more levels (colors) we have, the more accurate our fractal is.  With the programs listed, you can adjust the number of colors.   Keep in mind the TI-84 Plus CE has up to 15 colors, the Casio fx-CG50 has up to 7, and the HP Prime's colors have 256 levels of red, green, and blue.

You can download CHAOS1 for both the TI-84 Plus CE and HP Prime here:
https://drive.google.com/open?id=1A06e_pAPk7fMik07Pbi1tyjbLSUkVUN2

TI-84 Plus CE Program CHAOS1  (File:  CHAOS1.8xp)

For the Ti-84 Plus CE, I recommend the number of grid points of no more than 75.

The list of colors that I use in this code is:

1.  WHITE:  color value of 20
2. LTGRAY: color value of 21
3.  YELLOW: color value of 19
4.  ORANGE:  color value of 15
5.  BROWN: color value of 16
6.  GREEN: color value of 14
7.  LTBLUE:   color value of 18
8.  BLUE:  color value of 10
9.  BLACK: color value of 12

Note:  ⅈ represents √-1 ([Shift] [ 3 ])


Func: a+b ⅈ
FnOff: ClrDraw
Input "BORDER: ",B
Input "NO. GRID PTS: ",G
Input "PT C X+Yi: ", C
{20,21,19,15,16,14,18,10,12} → L6
dim(L6) → S
-B → Xmin: B → Xmax
-B → Ymin: B → Ymax
For(I, -B, B, 2B/G)
For(J, -B, B, 2B/G)
1 → K
I + J ⅈ→ Z
Lbl A
If abs(Z)>2 or K=S
Goto B
Z^2 + C → Z
1 + K → K
Goto A
Lbl B
L6(K) → L
Pt-On(I, J, 3, L)
End

Examples

B = 1, G = 75, C = -0.79 + 0.15i

B = 1, G = 75, C = 0.334 - 0.169i

HP Prime Program CHAOS1 (File:  CHAOS1.hpprgm)

I set 18 color levels, starting from white to black.   Because of the faster processor and calculating speed, I have increased the number of grid points to 500.  250 makes a picture with lines.

Note:  I use the parenthesis notation (x,y) for the complex number x + yi because the imaginary character i unfortunately does not transfer to computer text.  (updated 5/27/2019 - this allows for copying the code to the HP Prime connectivity kit/emulator)

EXPORT CHAOS1()
BEGIN
// 2019-05-19 EWS
LOCAL b,g,c,l6,s;
LOCAL i,k,j,z,l; 
STARTAPP("Function");
INPUT( {b, g, {c, [[0],[3]] }, "Fractal",
{ "Border: ", "Grid: ", "C: "},
{ "Min/Max - X/Y", "# Grid Pts", "C: x + yi " });
// size the screen
Xmin:=-b; Xmax:=b;
Ymin:=-b; Ymax:=b;
// clear the screen
RECT();
// list of colors
l6:= { #FFFFFFh, #C0C0C0h,
#D0D0D0h, #FFFF00h,
#B0B0B0h, #FF8000h,
#905000h, #400808h,
#00FF00h, #004060h,
#003000h, #00FFFFh,
#80D0FFh, #0000FFh,
#000080h, #400080h,
#404040h, #000000h};
// plotting
s:=SIZE(l6);

FOR i FROM -b TO b STEP (2*b)/g DO
FOR j FROM -b TO b STEP (2*b)/g DO 
k:=0;

REPEAT
k:=k+1;
IF k==1 THEN
z:=(i,j); 
ELSE
z: = z^2 + c;
END;
UNTIL ABS(z)>2 OR k==s;

l:=l6(k);
PIXON(i,j,l);
END;
END;

WAIT(0);
END;

Examples

B = 1, G = 500, C = 0.38 + 0.008i

B = 1, G = 500, C = -0.11 -0.8i

Have fun!  Explore the possibilities,

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.





Thursday, May 23, 2019

Review: EAI-350 Scientific Calculator

Review:  EAI-350 Scientific Calculator 



Basic Facts

Type:  Scientific
Display:  Two Line:  entry on the top and result on the bottom
Power:  Solar with battery backup, LR44
Memory Registers: 8:  A,B,C,D,E,F,X,Y,M
Price: $8.67, sold online:  https://www.eaieducation.com/Product/560440/CalcPal%C2%AE_EAI-350_Scientific_Calculator.aspx
Documentation:  2 fold out manuals, one full manual and one short manual detailing the more advanced functions

Keypad

The EAI-350 scientific calculator is similar to the Casio fx-991MS and fx-115MS.  The differences:

The keys are blue, white, and lime green.  The case is dark silver.  The keys work fine, but I don't think they are as solid as the Casio calculators.  The biggest flaw came in the keypad, I had to press the up on the keypad several times and with a firm touch.  This is not a deal breaker, just be something to aware of. 

Modes

The EAI-350 has a rich set of features.    The modes include:

*  Compute mode (general math mode)
*  Complex Mode  (arithmetic, x^2, √, Abs, arg, rectangular/polar conversions)
*  Statistics (single variable, Linear Regression, Logarithmic Regression, Exponential Regression, Power Regression, Inverse Regression, Quadratic Regression)
*  Base Operations (Decimal, Hexadecimal, Octal, Binary)
*  Equation Mode (2 x 2 and 3 x 3 linear systems, quadratic equations, cubic equations)
*  Matrices (3 matrices, up to 3 x 3)
*  Vectors (3 vectors, up to 3 elements)

One thing that I noted is that the logic functions only include AND, OR, and XOR.  Entering negative integers will require the use of the minus ([ - ]) key. 

Fractions

Fractions can be entered and calculated.  Results are simplified.  Fractions can be displayed as mixed fractions or improper fractions. 

Calculus

Calculus functions of the EAI-350 include the numeric integral, numeric derivative, evaluation, and a solve function.  The solve function can solve for any variable. 

Engineering Symbols

You can attach engineering symbols (powers of 10) to numbers from f (10^-15) to T (10^12). 

Constants and Conversions

The EAI-350 has 40 sets of conversions and 40 scientific constants.  You will need the fold out manual because calling the conversion and constants by numerical code.  The manual states that the constants are based on the 1992 ISO Standard and 1998  CODATA recommended values.  (a little dated)

Verdict

The EAI-350 is a good alternative to the Casio calculators.  The keyboard could be more solid, but it works.  I wish I could adjust the screen contrast, so be aware of where the calculator is operated because the screen can reflect. 

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.

Monday, May 20, 2019

Intensity/Illumination, Days Since Jan. 1, Derivatives: HP 20S and 21S

Intensity/Illumination, Days Since Jan. 1, Derivatives: HP 20S and 21S

Table of contents

1.  Intensity and Illumination
2.  Days Since January 1
3.  Numerical Derivative

Disclaimer: I believe the key codes for the programs in this blog entry are the all the same even though the HP 20S and HP 21S have slightly different codes.  Format:   Step  Key: Key Code.  I took turns programming the HP 20S and HP 21S.

1.  Intensity and Illumination

The follow equation relates the luminous intensity (measured in candelas, cd) and illuminance (measured in lux) of a light source.  The equation assumes the light source radiates a spherical matter.

E = I / R^2

E = illuminance
I = luminous intensity
R = radius of the sphere's light (meters)

LBL A:  Solve for E
LBL B:  Solve for I
LBL C:  Solve for R

Registers:
R0 = E
R1 = I
R2 = R

Store the following values in the register and execute the appropriate label.

Program:

01  LBL A:  61,41,A
02 RCL 1:  22, 1
03 ÷:  45
04 RCL 2:  22, 2
05 x^2:  51, 11
06 =: 74
07 STO 0:  21, 0
08 R/S:  26
09 LBL B:  61,41,B
10  RCL 0: 22,0
11  *:  55
12  RCL 2: 22,2
13  x^2:  51,11
14  =:  74
15  STO 1: 21, 1
16  R/S:  26
17  LBL C: 61,41,C
18  RCL 1: 22,1
19 ÷: 45
20 RCL 0: 22,0
21  =:  74
22 √:  11
23 STO 2: 21, 2
24 R/S:  26

Example 1:
R1 = I = 400, R2 = R = 2.
Solve for E,  XEQ A returns 100

Example 2:
R0 = E = 180, R2 = R = 3
Solve for I, XEQ B returns 1620

Example 3:
R1 = I =420, R0 = E = 195
Solve for R, XEQ C returns 1.467598771

2.  Days Since January 1

Calculate the number of days since January 1.  For more information, please see:  http://edspi31415.blogspot.com/2019/03/ti-84-plus-and-hp-41c-number-of-days.html

Input:
R1:  day
R2: month
R3: 0 if we are working in a non-leap year, 1 if we are working in a leap year

Output:
R4:  number of days since January 1

Program:

01 LBL A: 61,41,A
02 RCL 1:  22,1
03 STO 4: 21, 4
04 3:  3
05 5:  5
06 STO - 4:  21,65,4
07 RCL 2: 22,2
08  INPUT:  31
09  2:  2
10  x ≤ y?:  61,42
11  GTO 2:  51,41,2
12  RCL 2: 22,2
13  *:  55
14  3:  3
15  0:  0
16  . : 73
17 6:  6
18  +:  75
19  1:  1
20  .  : 73
21  6:  6
22  =:  74
23  IP:  51, 45
24  STO + 4:  21,75,4
25  RCL 3:  22,3
26  STO + 4:  21,75,4
27  RCL 4: 22,4
28  RTN:  61, 26
29  LBL 2:  61,41,2
30  RCL 2:  22,2
31   *:  55
32  3:  3
33  0:  0
34  .  : 73
35  6:  6
36  +:  75
37  3:  3
38  6:  6
39  8:  8
40:  .  : 73
41  8:  8
42 =: 74
43  IP:  51,45
44  STO + 4:  21,75,4
45  3:  3
46  6:  6
47  5:  5
48  STO - 4:  21,65,4
49  RCL 4:  22,4
50  RTN:  61,26

Example 1:
1/1/2019 - 5/7/2019  (non-leap year)
R1:  7,  R2:  5,  R3:  0
Result:  R4 = 126

Example 2:
1/1/2020 - 11/14/2020  (leap year)
R1:  14,  R2:  11, R3:  1
Result:  R4 = 318

3.  Numerical Derivative

f'(x0) ≈ ( f(x0 + h) - f(x0 - h) ) / ( 2*h )

x = point
h = small change of x, example h = 0.0001

LBL A:  Main Progam
LBL F:  f(X), where R0 acts as X

Input variables:
R1 = h
R2 = point x0

Used variables:
R0 = x   (use R0 for f(x), LBL F)

Calculated Variables:
R3 = f'(x)

Radians mode will be set.

Program:

01  LBL A:  61,41A
02  RAD:  61,24
03  RCL 2:  22,2
04  +:  75
05  RCL 1:  22, 1
06  =:  74
07  STO 0:  21,0
08 XEQ F:  41,F
09  STO 3:  21, 3
10  RCL 2: 22,2
11 -:  65
12 RCL 1: 22,1
13 =:  74
14 STO 0: 21,0
15 XEQ F:  41,F
16 STO - 3:  21,65,3
17 2:  2
18 STO ÷ 3:  21,45,3
19  RCL 1:  22,1
20 STO ÷ 3: 21,45,3
21  RCL 3:  22,3
22 R/S:  26
23 LBL F:  61,41,F
...
xx  RTN:  61,26  (end f(X) with RTN)

Example:  e^x * sin x

LBL F
RCL 0
e^x
*
RCL 0
SIN 

RTN

R1 = 0.0001
R2 = x0 = 0.03
Result:  1.060899867

R1 = 0.0001
R2 = x0 = 1.47
Result:  4.7648049


Note:  I am going on vacation this week and I have jury duty in June. So far, I have blog entries scheduled to be posted throughout June 22.  I plan to have a weekly post every Saturday in June.  - E

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.

Thursday, May 16, 2019

Casio fx-CG50 and HP Prime: Azimuth/Bearing Conversions

Casio fx-CG50 and HP Prime: Azimuth/Bearing Conversions

Introduction




The programs A2B (Azimuth to Bearing) and B2A (Bearing to Azimuth) convert angles between two measuring systems that are commonly used by civil engineers and navigators.

The program uses an unusual approach: the use of the arcsine, sine, and cosine functions.   These functions are used on because on scientific calculators, the trigonometric functions return answers in specific ranges.

Let x be a real number.  then:

asin(x) returns answers in the range -90° to 90°  (-π/2 to π/2 radians)

acos(x) returns answers in the range 0° to 180°  (0 to π radians)

atan(x) returns answers in the range -90° to 90°  (-π/2 to π/2 radians)

This was used in the HP 33E program from the calculator book "HP 33E: Surveying Applications".  See Source below.

Formulas:

A = azimuth
B = bearing
Q = quadrant  (1,2,3,4)

Azimuth to Bearing:

B = abs( asin( sin A ) )
Q = int(A/90 + 1)

(Yes, the asin/sin is there for a purpose: to get an angle in the range of -90° to 90°)

Bearing to Azimuth:

A = 180° * int(Q/2) - B * cos(Q * 180°)

In the programs A2B and B2A, both input and output will be degrees-minutes-seconds format.

To enter degrees-minutes-seconds:

Casio fx-CG50:  [ OPTN ] [ F6 ] (more) [ F5 ] (ANGLE)  [ F4 ] (° ' ")

HP Prime:  [ Shift ] [ a b/c ] or [ Shift ] [ 9 ] (select °, ', or '' from the menu)

Azimuth to Bearing Program A2B

Casio fx-CG50 Program A2B (Azimuth to Bearing)

ClrText
Locate 1,4,"AZIMUTH TO BEARING"
Deg
"AZ: "? → A
Abs( sin^-1 ( sin A ) ) → B
"BEARING ="
B ▶ DMS ◢
Intg( A ÷ 90 + 1 ) → Q
"QUADRANT = "
Q = 1 ⇒ "NE"
Q = 2 ⇒ "SE"
Q = 3 ⇒ "SW"
Q = 4 ⇒ "NW"

HP Prime Program A2B (Azimuth to Bearing)

EXPORT A2B(A)
BEGIN
// Azimuth to Bearing
HAngle:=1;  // Degrees
LOCAL B, Q, L0:={"NE","SE","SW","NW"};
B:=ABS(ASIN(SIN(A)));
Q:=IP(A/90+1);
RETURN { →HMS(B), L0(Q) }
END;

Example 1:  220° 15' 36"
Result:  40°15'36". SW

Example 2:  184°00'14"
Result: 4°00'14"  SW

Bearing to Azimuth Program B2A

Casio fx-CG50 Program B2A  (Bearing to Azimuth) 

ClrText
Locate 1,4,"BEARING TO AZIMUTH"
Deg
"BEARING: "? → B
Menu "QUADRANT", "NE", 1, "SE", 2, "SW", 3, "NW", 4
Lbl 1: 1 → Q: Goto 5
Lbl 2: 2 → Q: Goto 5
Lbl 3: 3 → Q: Goto 5
Lbl 4: 4 → Q: Goto 5
Lbl 5
180 * Intg( Q ÷ 2 ) - B * cos( Q * 180 ) → A
"AZ ="
A ▶ DMS

HP Prime Program B2A (Bearing to Azimuth)

Arguments:  Bearing, Quadrant.  You can enter Quadrant by a string or numerical quadrant.  "NE" = 1,  "SE" = 2,  "SW" = 3, "NW" = 4

EXPORT B2A(B,q)
BEGIN
// Bearing to Azimuth
// q "NE", "SE", "SW", "NW"
// or 1,2,3,4
LOCAL A, L0:={"NE","SE","SW","NW"};
HAngle:=1;  // Degrees
// deal with strings
IF TYPE(q)==2 THEN
q:=POS(L0,q);
END;
A:= 180 * IP(q/2) - B * cos(q * 180);
RETURN →HMS(A);
END;

Example 3:  43°21'55"  SW (q = 3)
Result:  223°21'55"

Example 4:  13°14'56"  SE (q = 2)
Result:  166°45'04"

Source:

Hewlett Packard.  "HP33E:  Surveying Applications"  Hewlett Packard Company.  March 1978

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.

Monday, May 13, 2019

HP 42S/DM42/Free42: Room Cavity Ratio, Luminous Intensity and Illuminance

HP 42S/DM42/Free42:  Room Cavity Ratio, Luminous Intensity and Illuminance

Room Cavity Ratio



The room cavity ratio is used to assist in calculating lighting efficiency in determining where to place ceiling lights in an office room.  The formula is:

RCR = INT( ( 5 * H * ( L + W ) ) / ( L * W ) )

where:
L = length of the room
H = height difference between floor cavity and ceiling cavity
W = width of the room

HP 42S/DM42/Free42:  Solver RCR

LBL "RCR"
MVAR "H"
MVAR "L"
MVAR "W"
MVAR "RCR"
5
RCL * "H"
RCL "L"
RCL + "W"
*
RCL "L"
RCL * "W"
÷
IP
RCL - "RCR"
END

Examples

Example 1: 
Input:  H = 5.5, L = 16.8, W = 13.7.   Result:  RCR = 3

Example 2:
Input: H = 5.5, L = 16.8, RCR = 4.  Result:  H = 7.1650

Sources:

Dilouie, Craig.  "Lighting Design:  Example of Role Surfaces Play in Lighting Efficiency"  LightNOW  https://www.lightnowblog.com/2010/06/example-of-role-surfaces-play-in-lighting-efficiency/  June 16, 2010.  Retrieved March 31, 2019

"Room Cavity Ratio, RCR" Illuminating Engineering Society.  https://www.ies.org/definitions/room-cavity-ratio-rcr/  July 5, 2018.  Retrieved April 28, 2019

Luminous Intensity and Illuminance

The follow equation relates the luminous intensity (measured in candelas, cd) and illuminance (measured in lux) of a light source.  The equation assumes the light source radiates a spherical matter. 

E = I / R^2

E = illuminance
I = luminous intensity
R = radius of the sphere's light (meters)

HP 42S/DM42/Free42:  Solver ILSPH

LBL "ILSPH"
MVAR "E"
MVAR "I"
MVAR "R"
RCL "E"
RCL "I"
RCL "R"
x ↑ 2
÷
-
END

Examples

Example 1:
Input:  I = 10 cd, R = 2 m.  Result:  2.5 lux

Example 2:
Input:  R = 3.65 m, E = 30 lux.  Result:  I = 399.6750 cd

Sources:

Daryanani, Sital  Building Systems Design With Programmable Calculators Architectural Record Books.  McGraw-Hill Book Company: New York.  1980.  ISBN 0-07-015415-5

Zumtobel "The Lighting Handbook" Zumtobel Lighting GmbH.  Dornbirn, Austria.  6th Edition: 2018  https://www.zumtobel.com/PDB/Ressource/teaser/en/Lichthandbuch.pdf

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.

Saturday, May 11, 2019

Casio Calculators and the Percent Key

Casio Calculators and the Percent Key

Introduction

The percent function on Casio calculators varies based on the calculator itself.  Let's compare six key algorithms on six Casio calculators, five current and one from the past.  We will go from the most consistent behavior to the least.

The calculators used in this study are:

SL-300VC  (four function calculator)
fx-260 Solar II  (scientific calculator - one line display)
fx-300MS 2nd Edition (scientific calculator - one line display)
fx-115ES Plus  (scientific calculator - textbook display)
fx-991EX Classwiz (scientific calculator - textbook display)
fx-115D  (scientific calculator introduced in 1991 - one line display)

Let A and B be real numbers.  In the following examples, required press of the [SHIFT] key are implied as required. 

Algorithm 1:  Multiply

Keystrokes:  A [ × ] B [ % ]

Let A = 82, B = 30

SL-300VC:  24.6 
fx-260 Solar II:  24.6
fx-300MS 2nd Edition:  24.6
fx-115ES Plus**:  123/5 ([ S<>D] 24.6) 
fx-991EX Classwiz**:  123/5  ( [ S<>D] 24.6)
fx-115D:  24.6

A [ × ] B  [ % ] calculates A * B/100.  No surprise that the results will be consistent across the board. 

**Pressing equals ( [ = ] ) is required to complete calculations involving percent calculations for the calculators with textbook display. 

Algorithm 2:  Division

Keystrokes:  A [ ÷ ] B [ % ]

Let A = 82, B = 30

SL-300VC:  273.33333 
fx-260 Solar II:  273.3333333
fx-300MS 2nd Edition:  273.3333333
fx-115ES Plus:  820/3 ([S <> D] 273.3333333) 
fx-991EX Classwiz:  820/3 ([S <> D] 273.3333333)
fx-115D: 273.3333333

A [ ÷ ] B calculates A  * 100/B.   Results are consistent across the board.

Algorithm 3:  Adding Percents

Keystrokes:  A [ × ] B [ % ] [ + ]  

A = 57, B = 11

SL-300VC: 63.27 
fx-260 Solar II: 63.27
fx-300MS 2nd Edition:  63.27
fx-115D:  63.27 

This calculates A * (1 + B/100)

If you tried the exact algorithm with the textbook style calculators like the fx-115ES Plus and the fx-991EX Classwiz, you get an error.  Use the following instead:   A [ (  ] 1 [ +  ] B [ % ] [  ) ] [ = ]

Algorithm 4:  Subtracting Percents

Keystrokes:  A [ - ] B [ % ] [ + ] 

A = 57, B = 11

SL-300VC: 50.73
fx-260 Solar II: 50.73
fx-300MS 2nd Edition:  50.73
fx-115D:  50.73 

This calculates A * (1 - B/100)

If you tried the exact algorithm with the textbook style calculators like the fx-115ES Plus and the fx-991EX Classwiz, you get an error.  Use the following keystroke algorithm instead:   A [ (  ] 1 [ -  ] B [ % ] [  ) ] [ = ]

Algorithm 5:  A - B%

Keystrokes:  A [ - ] B [ % ]

SL-300VC: 12.5 
fx-260 Solar II: 12.5
fx-300MS 2nd Edition: 12.5
fx-115ES Plus:  1784/25 ( [S<>D] 71.36) 
fx-991EX Classwiz:  1784/25 ( [S<>D] 71.36) 
fx-115D: 12.5

We see some difference on how this algorithm is calculated and it depends on the type of calculator used.

For four-function basic calculators and one-line scientific calculators, A - B% calculates the percent change:  (A - B)/B * 100

For the  textbook display calculators, the B is merely divided by 100 and subtracted from A:  A - B/100

Algorithm 6:  A + B%

Keystrokes:  A [ + ] B [ % ]

SL-300VC: 200
fx-260 Solar II: 300
fx-300MS 2nd Edition: 300
fx-115ES Plus:  201/2 ( [S<>D] 100.5) 
fx-991EX Classwiz:  201/2 ( [S<>D] 100.5) 
fx-115D: 300

This is the most inconsistent.  Quite honestly, I don't recommend this algorithm. 

What I learned:

1.  Check your manual on how to use the percent function ( % ), not matter what calculator you use. 

2.  Calculators with textbook display, the percent function ( % ) merely divides the argument by 100.

3.  This is an sample of six calculators, and as you can see, your mileage may vary. 

Have fun calculating,

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.

Thursday, May 9, 2019

Review: Casio fx-300MS 2nd Edition

Review:  Casio fx-300MS 2nd Edition





General Information

Company:  Casio
Type:  Scientific - Algebra (Perfect Algebra Method)
Display: 10 digits with 2 digit exponents
Power:  Solar with battery backup (LR-44)
Memory Registers:  8: A, B, C, D, E, F, X, Y, M
Years In Production: 2019 - present
Cost:  $10 - $20 (CVS sells this for $21, the only place in Southern California that carries the fx-300MS 2nd Edition - for now (as of 4/26/2019))
Documentation:  Manual, can be found online

Also known as:  fx-85MS 2nd Edition

Quick Overview of the Features

*  Trigonometry, Exponential, Logarithms
*  Factorial (of positive integers up to 69), Combinations, Permutations
*  Evaluating Algebraic Expressions up to 79 Characters
*  Memory Arithmetic with M  (M+ and M-)
*  Multi-statement analysis (connected by a colon  ( : ))
*  Statistics including six regressions:  Linear, Logarithm, Exponential, Power, Inverse, Quadratic
*  Fractions: Simplification, conversion between mixed and improper
* Contrast setting
* Two line display: the top line is for the expression and the bottom line is displays the answer

Function wise, the fx-300MS 2nd Edition is the same as the original edition of the fx-300MS and fx-85WA.  For my review on the Casio fx-85WA, click here:     http://edspi31415.blogspot.com/2019/01/retro-review-casio-fx-85wa.html

What is Different of the Second Edition?

Left:  fx-300MS,  Right:  fx-300MS 2nd Edition 


Last year, Casio introduced its revamped MS series with the goal of redesigning the calculator series. 

The MS loses its curvy shape in favor of a rounded box design, which is made to feel more comfortable when operating in the calculator in the hand. I favor this design as the 2nd Edition feels more comfortable in the hand. 

Close up of the numeric keys:  Left:  fx-300MS Plus, Right:  fx-300MS Plus 2nd Edition

The fonts on the keys are larger and the keys have better font-background ratio, which results in the keys being more readable.  The number keys are bigger hand have a charcoal black background instead of a gray background. 

The arrow keyboard is replaced with four separate arrow keys.  Instead of four rounded keys for [SHIFT], [ALPHA],[MODE], and [CLEAR], the keys are circular.  The exponent key [ EXP ] has been replaced with [ x10^x ], a trend with Casio scientific and graphing calculators.

I like the feel of the keys on the 2nd Edition a lot better than the previous edition, the keys feel more firm and steady to the touch. 

The display is similar to the previous edition, except that it is more sensitive to the touch.  Just be careful when you are handling the calculator near the display. 

Slide Case for the fx-300MS 2nd Edition

I don't know if this is first, but the MS series slide case is designed to attach and detach in two ways, so no matter where the top of the calculator is pointed, the case will fit on.  This is a really neat feature which I assume that Casio is going to continue when producing future scientific calculators. 

Verdict

I like the keyboards of the 2nd Edition MS series, the calculators look more high-tech, the keyboard is firmer,  and I love the large font on the keys.  I am now looking to get the fx-991 MS 2nd Edition.  That said, if you have the original edition, there really isn't a need to trade it or be rid of it, the original edition is still adequate for use. 

I guess it boils down to a matter of preference.  If you want the 2nd Edition and can find one (especially in the United States, I may have to go online for the fx-991 MS 2nd Edition), go for it. 

Happy calculating,

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.



Monday, May 6, 2019

HP Prime and HP 42S/DM42/Free42: Length of V Belts Solver

HP Prime and HP 42S/DM42/Free42:  Length of V Belts Solver

Introduction



The following equation relates the length of a V belt, the center to center distance between two pulleys or sheaves:

L = 2 * C + 1.57 * (D + d) + (D - d)^2/(4 * C)

where:

L = length of the V belt, the belt that wraps around two pulleys (or sheaves)
C = center to center distance
D = diameter of the large pulley/sheave
d = diameter of the small pulley/sheave

HP Program VBELT

This program creates four global variables:

beltlength = L
centerdist = C
lrgpulley = D
smpulley = d

The program then takes you to the Num page of the Solve app.  This allows us to create descriptive variables to help us in the Solve app. 

Global variables are created outside the main program.

// create global variables
// outside the main program
EXPORT beltlength;
EXPORT centerdist;
EXPORT lrgpulley;
EXPORT smpulley;


EXPORT VBELT()
BEGIN
// 2019-04-28 EWS

STARTAPP("Solve");

// uncheck E0-E9
LOCAL k;
FOR k FROM 0 TO 9 DO
Solve.UNCHECK(k);
END;

// enter equation to E1
E1:="beltlength=2*centerdist+
1.57*(lrgpulley+smpulley)+
(lrgpulley-smpulley)^2/
(4*centerdist)";
Solve.CHECK(1);

// go to Num View
STARTVIEW(2);

END;

HP 42S/DM42/Free 42 Solver Program VBELT

Use the SOLVER function win calling VBELT. 

LPULLEY:  large pulley/sheave diameter
SPULLEY: small pulley/sheave diameter

LBL "VBELT"
MVAR "LENGTH"
MVAR "CENTER"
MVAR "LPULLEY"
MVAR "SPULLEY"
2
RCL * "CENTER"
RCL "LPULLEY"
RCL + "SPULLEY"
1.57
*
+
RCL "LPULLEY"
RCL - "SPULLEY"
X ↑ 2

÷
RCL ÷ "CENTER"
+
RCL - "LENGTH"
END

Examples

Example 1:
Large Pulley Diameter = 1 in
Small Pulley Diameter = 3/4 in
Center to Center Distance = 1.5 in
Result:  V Belt Length ≈ 5.7579 in

Example 2:
Large Pulley Diameter = 1 in
Small Pulley Diameter = 7/16 in
V Belt Length = 6.24 in
Result: Center to Center Distance ≈ 1.975 in

Source:

Gladstone, John Air Conditioning Testing and Balancing: A Field Practice Manual Van Nostrand Reinhold Company: New York.  1974  ISBN 0-442-22703-5

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.

Thursday, May 2, 2019

HP Prime and Casio fx-CG50 MicroPython: √(x + √(x + √(x + ... )))

HP Prime and Casio fx-CG50 MicroPython:  √(x + √(x + √(x + ...  )))

Introduction

Made with LibreOffice Math


The program SQRADD attempts to find a calculation to:

√(x + √(x + √(x + ...  )))

That is:

1.  Start with a number x  (any positive number, we're assuming that we are in the Real Number domain)
2.  Take the square root
3.  Add x to the result
4.  Take the square root of the result
5.  Repeat steps 3 and 4 forever. (or until a condition is satisfied, such as machine accuracy is reached)


HP Prime Program SQRADD

The loop repeats until the difference between two terms is less than machine accuracy, 1E-12 (since HP Prime has floating point accuracy of 12 digits).  Output:  {x, answer, number of iterations it took to get machine accuracy}

EXPORT SQRADD(X)
BEGIN
// 2019-04-28 EWS
// √(X+√(X+√(X+...)))

// setup
LOCAL T,U,N:=1;
T:=√X;
U:=√(X+T);

// loop
WHILE ABS(U-T)≥1E−12 DO
T:=U;
U:=√(X+T);
N:=N+1;
END;

// display results {X,U,N}
RETURN {X,U,N};
END;

Casio fx-CG50 MicroPython Script sqradd.py

Use the Python mode of the Casio fx-CG50 (software versions 3.2 or greater).  For more information of this procedure, please see: http://edspi31415.blogspot.com/2018/10/casio-fx-cg50-version-320-python-comes.html

# 2019-04-28 EWS

import math

# sqrt(X+sqrt(X+...))
# declare variables
# as float
N=1.0
X=float(input("X="))
T=float(math.sqrt(X))
U=float(math.sqrt(X+T))

# loop
# Casio Micropython
# has precision of 15
while abs(U-T)>=1e-15:
  T=U
  U=math.sqrt(X+T)
  N+=1

# results
print("X= "+str(X))
print("Result= ")
print(str(U))
print("Iterations= "+str(N))

Procedure on a Four-Function or Desktop Calculator

1.  Clear the memory (usually [ MRC ] [ MRC ] )
2.  Enter x and store it in memory  (x  [ M+ ] )
3.  Take the square root [ √ ]
4.  Repeat this loop (until machine accuracy is reached, that is, the the result doesn't "change"):  [ + ] [ MR ] [ = ] [ √ ]

Results

HP Prime

x = 1,  Result:  1.61803398875, 23 iterations
x = 2, Result:  2,  20 iterations
x = 3,  Result: 2.30277563773, 18 iterations
x = 4, Result: 2.56155281281, 17 iterations
x = 5, Result: 2.79128784748, 17 iterations
x = 6, Result: 3,  16 iterations
x = 7, Result: 3.19258240357, 16 iterations
x = 8, Result: 3.37228132327, 15 iterations
x = 9, Result:  3.54138126514, 14 iterations
x = 10, Result: 3.70156211871, 14 iterations
x = 11, Result: 3.85410196624, 13 iterations
x = 12, Result: 4,  14 iterations
x = 20, Result: 5, 12 iterations
x = 30, Result: 6, 12 iterations
x = 42, Result: 7, 11 iterations
x = 56, Result: 8, 11 iterations

Casio fx-CG50 MicroPython

x = 1, Result:  1.618033988749895, 30 iterations
x = 2, Result: 2,  26 iterations
x = 3, Result: 2.302775637731994, 24 iterations
x = 4, Result: 2.56155281280883, 22 iterations
x = 5, Result: 2.79128784747792, 21 iterations
x = 6, Result: 3, 20 iterations
x = 7, Result: 3.192582403567252, 20 iterations
x = 8, Result: 3.372281323269014, 19 iterations
x = 9, Result: 3.54138126514911, 19 iterations
x = 10, Result: 3.701562118716424, 18 iterations
x = 11, Result: 3.854101966249685, 18 iterations
x = 12, Result: 4, 18 iterations
x = 20, Result: 5, 16 iterations
x = 30, Result: 6, 15 iterations
x = 42, Result: 7, 14 iterations
x = 56, Result: 8, 14 iterations

Some Interesting Observations

When x = 1, the result is the Golden Ratio, Φ = (1 + √5)/2.

When x = n * (n-1) where n is an integer and n ≥ 2, the result is n. 

Examples: 
x = 2 =  2 * 1, result: 2
x = 12 = 4 * 3, result: 4
x = 56  = 8 * 7, result: 8
x = 240 = 16 * 15, result: 16
x = 992 = 32 * 31, result:  32

Fun stuff.  What other patterns can we find with this or other similar calculation?  Until next time,

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.