Saturday, April 27, 2013

Java Brew Coffee House and Other Saturday Adventures

I hope everyone is doing well today! I am coming to you form Java House Coffee Shop in Montrose, CA.

This morning I went to the Glendale College Library. Guests have to park on the top lot. To get to the campus required a combination stair climbing and taking elevators. I love the view from the top.

Among subjects studied today are centriods, inverse problems, and surface integrals. Three hours went by and I left 20 minutes before the library closed, which only proves the saying "So much to do, and so little time."

Here is some of what studied today:
------
Centriods:

Points (x,y) each with mass m:

X-bar: Σ(x*m)/Σm, Y-bar: Σ(y*m)/Σm

Continuous functions, uniform thickness and density, f(x) ≥ g(x), limits a ≤ x ≤ b,

M_y = ∫(x * (f(x) - g(x)) dx, a, b)
M_x = 1/2 * ∫( (f(x))^2 - (g(x))^2, x, a, b)
M = ∫( f(x) - g(x) dx, a, b)

X-bar: M_y/M, Y-bar: M_x/M

Jon Guilleberg. "Mathematics: From the Birth of Numbers." W.M. Norton & Co. 1997

Normal Vectors

If a vector is perpendicular to another vector, the former vector is known as a normal vector. We can find a normal vector to any two vectors U and V by the cross product.

N = U × V

And the Unit Normal Vector:

n = (U × V)/|U × V| = vector/(norm of a vector)

Applying the normal unit vector to a said function z = f(x,y):

n = [-df/dx, -df/dy, 1] / √( 1 + (df/dx)^2 + (df/dy)^2 )

A unit vector has length 1.

Pretend that "d" is the partial derivative operator.

Surface area of z = f(x,y) over region R is:

∫ ∫ (√( 1 + (df/dx)^2 + (df/dy)^2 ) dx dy

H.M. Schey "div grad curl and all that" W.M. Norton & Co. 1992

Yes the title was in all lowercase. I get weirdly fascinated by all-lowercase titles.



Going to finish my lunch, and do some programming. Love to all of you!

Eddie


This blog is property of Edward Shore. 2013

Tuesday, April 23, 2013

HP 39gii Programming Tutorial - Part 8: Functions in Programs


HP 39gii Programming Tutorial - Part 8: Functions as Arguments

Apologies for the delay.

In part 8, I will show you several was you can use functions as arguments in programs. First, some pointers to help make the programming experience less daunting:

1. The HP 39gii is not a CAS machine. Everything must be evaluated to a number.

2. Functions are entered either as strings (expressions surrounded by quotation marks) or by the use of the QUOTE command. The QUOTE command can be found by pressing [Math], [ 1 ], [ 2 ]. It may help to store the required equation/function in E#/F# first before running the program, which is the case with PARTDER.

3. When using HP mathematical commands, you may have to store pass-through variables into global variables first. I am not sure why this is true for some commands but not for others.

4. The use of expressions and functions don't always work in programming. Use caution. I have particular trouble with SOLVE and FNROOT in this situation.

--------

Note: Recall there are two ways to store objects, one the store arrow ( →) and the assign operator ( := ). I usually code the latter, but for most applications, either way is acceptable. I use both methods in today's programming examples. And yes, we can use both methods in one program.

Hint: I often test commands and their usage at the Home screen to get a better understanding on how mathematical commands work. I also note their syntax by both using the command and accessing the help menu ([SHIFT] [Views]).

------

The Program PARTDER

PARTDER takes the partial derivatives of the function f(X,Y) at the point (x, y) and returns a list of the values {df/dx, df/dy}.

PARTDER takes two pass-through arguments:
x = value of x
y = value of y

Define f(X,Y) as a string into E0 outside the program.

EXPORT PARTDER(a,b)
BEGIN
a → A; b →Y; ∂(E0, X=A) → C;
b → B; a → X; ∂(E0, Y=B) → D;
RETURN {C, D};
END;


Examples:

"SIN(X*Y)+Y^2"→E0
PARTDER(π, 1) returns { -1, -1.14159265359 }

QUOTE(X^(2*Y+1))→E0
PARTDER(4,1) returns {48, 177.445678223}

Eddie

This blog is property of Edward Shore. 2013

Sunday, April 21, 2013

My Slide Rule Collection

I have a small collection of slide rules. Slide rules, which first made their appearance in the 1620s, was the calculator before electronic calculators became prominent in the 1970s.

Having been born three years after the slide rule disappeared from the mainstream I first came across slide rules for the first time when I found my grandfather's book "The Slide Rule and How To Use It". It took me a while to get an understanding how they work, but I think I have a beginner's idea how slide rules work, or getting used to the idea of logarithmic scales.

The scales I know about are:
C and D: Used for multiplication and division
CI and DI: Reciprocal of the C and D scales
A: the square of scale C and D
K: the cube of the scale C and D
L (and LL): logarithmic scales
S: sine
T: tangent

A → D: √
D → A: x^2
K → D: cube root
D → K: cube
S → D: (sin x°)/10
D → S: asin(x/10)... I think
D → L: log x
L → D: 10^x

I think the LL scale is a natural logarithm/exponential scale.

Thank you William Oughtred for inventing the slide rule.

Here is my collection:

Lawrence Deluxe Slide Rule with the book it came with: "The Slide Rule and How to Use It".

This what I found in the garage. Now this sits in my bookshelf.

Scales: A, B, C, CL, D, K

Keuffel & Essel Co. Model 4098A (I think I am correct on the model number)

I picked up this slide rule last year at a swap meet in Azusa for two bucks. What is interesting about this slide rule is that it is six inches long, has a five inch/13 centimeter ruler in the back. The middle part of the scale is removable to reveal the S, L, and T scales in the back.

Scales: A, D. Middle part: B, C. (S, L, T in the back)

Ditizgen Polymath Multiplex

I bought this slide rule in Pomona several months ago for $7. Unfortunately, the case that it came in crumbled. It now has a towel as a case.

Scales:
Front: LL01, K, A, CF, CIF, L, CI, C, D, DI, LL1
Back: LL02, LL03, DF, B, T<45°, T>45°, ST, S, D, LL3, LL2

Keuffel & Esser Co. 4181-3

My dad and I went to the swap meet at Glendale College this morning. Pretty good swap meet despite it being on the small side. A lot of high-end stuff. I got this slide rule for $7.

Slides:
Front: LL02, LL03, DF, CF, CIF, CI, C, LL3, LL2
Back: LL01, L, K, A, B, T, ST, S, D, DI, LL1



I like to work with slide rules every once in a while - fun!

Eddie

This blog is property of Edward Shore. 2013

Thursday, April 18, 2013

HP 39gii Programming Tutorial Update

There will be a Part 8 of the HP 39gii calculator tutorial series. I plan to have it posted by next week.

Part 8 will involve programs that use functions and equations as parameters.

Hope everything is well. It is a crazy world out there!


Eddie


This blog is property of Edward Shore. 2013

Saturday, April 13, 2013

The Weekend's Here: A preview of what's coming next.

Hi everyone! I am at a local Starbucks. Love the coffee shop atmosphere - and coffee.

Way I doing today and over the next few weeks is taking some programs from the classic Hewlett Packard manuals, particularly the 1970s (25, 45, 67, 33E, etc) and programming them on today's calculators (35S, 39gii, 15c LE, 50g). I expect that I will end up using resources from Texas Instruments and Casio as well. I aim to post some programs on my blog starting in May.

Have a great and fun weekend! Thank you for your continual support and comments!

Eddie


This blog is property of Edward Shore. 2013

Tuesday, April 9, 2013

TI-84 Plus C Silver Edition Review

TI-84 Plus Color Silver Edition Review

The changes are mostly positive as TI takes another step forward while maintaining the classic system TI-84+ users are accustomed to.

The good:

No steep learning curve from older 82/83/84 models - just a few more additional commands, mainly revolving around color. You can pretty much pick the TI-84+ CSE up and operate it like any other version of the 82/83/84.

15 colors to work with in graphing and drawing.

Rechargeable batteries - and they are much better than TI nSpire CX's. A charge can last a week or better pending on regular use, a day on heavy use (like plotting every point on the graph screen), charges to full quickly.

Backlit screen

Current mode settings are now on top of the screen at all times.

Up to 10 pictures can are stored in archive memory and still be recalled without having to take up RAM.

The not so good:

Decrease in RAM for 24,000 bytes to 21,000 bytes. This really does not affect you unless you do a lot of programming (like me). We still have a TON of archive ROM to store programs away if you don't plan on using them for a while.

Native trig functions still do not support complex numbers.

Graph screen does not take the whole screen - there is a border.

Graphing equations is slightly slower than its predecessors; however it is not a deal breaker.

Price: around $130, depending on vendor. I got mine for $129. Will the TI-84+ CSE replace the monochrome TI-84+ Silver Edition when the color edition hits the mainstream? I do not know.

Worth buying, especially if
(1) you have not purchased an 84+ before,
(2) am a TI and/or calculator enthusiast, or
(3) want a color calculator with a classic operating structure.

Overall, I enjoy using this calculator.

I leave you with this tip and some screen shots.

Tip: Run programs in Classic mode, they run faster than programs ran in MathPrint mode. This is for any TI-84+ models.

Have a great day! Eddie



This blog is property of Edward Shore. 2013


Monday, April 8, 2013

Using Color Calculators to Plot Patterns (TI-84+CSE, Casio Prizm)

We are in the age of color graphing calculators (and mobile apps). While the Casio Prizm and TI nSpire CX (with and without CAS) got the age started, it could be the next crop of color calculators, such as the TI-84+ Color Silver Edition that puts color into the mainstream.

These patterns are generated by using four colors and a function f(x,y) where

f(x,y) = remainder( int(Φ(x,y)) / 4)

with Φ(x,y) is a positive function. The value of f(x,y) determines on of four colors. I used the DRAWPATTERN (page 269 of the HP 39gii manual, 1st edition) as a template.

With the TI-84+ Color Silver Edition it takes about 40-45 minutes to complete. The real surprise (to me at least), was I did one with the Casio Prizm, which it took about six hours to complete; I was surprised there was any battery left. This is where the advantage of rechargeable battery of the TI-84+ CSE comes in. I am happy then to report that the battery of the TI-84+ CSE held up well.

Without any further ado, here are the graphics created! Nice way to spend a Sunday afternoon, I think.

With each picture I will list Φ(x,y). The window, except noted, is Xmin=-10, Xmax=10, Ymin=-10, Ymax=10.

Recall: f(x,y) = remainder( int(Φ(x,y)) / 4)

Until next time,

Eddie


This blog is property of Edward Shore. 2013


Friday, April 5, 2013

HP 39gii Programming Part 7: Using App Specific Commands

I hope you are all enjoying the day/night so far. The subject of Part 7 of the HP 39gii will be App-Specific commands.

We will work with app and global variables, as well as switching applications and doing App specific commands to our advantage. The two primary commands we will work with are STARTAPP and STARTVIEW.

STARTAPP and STARTVIEW

STARTAPP does what it advertises: starts the specific application called. The required application is stated as a string. For example, STARTAPP("Function") starts the Function graphing app. Running this command is key if you want the user to access specific screens, such as the Symbolic, Plot, and Numeric screens.

Keyboard sequence for STARTAPP is: [Shift] [Math] [ F1 ] [ 1 ] [ 2 ].

Applications include:

"Function" - Function Graphing
"Parametric" - Parametric Graphing
"Polar" - Polar Graphing
"Sequence" - Recurring Sequence Graphing
"Solve" - Solver Interface
"Triangle Solver" - Application for solving sides and angles of triangles
"Finance" - Time Value of Money Application
"Statistics 1Var" - 1 Variable Statistics
"Statistics 2Var" - 2 Variable Statistics
"Inference" - Hypothetical Testing and Confidence Intervals
"Linear Explorer" - Teaching application regarding linear equations
"Quadratic Explorer" - Teaching application regarding quadratic equations
"Trig Explorer" - Teaching application regarding trigonometric functions
"Data Streamer" - Application that works with Hewlett Packard's StreamSmart devices (data collection from various apparatus)

STARTVIEW leaves the user at a specific view, such as the Home screen, Plot screen, etc. Each screen has a specific view code, with syntax STARTVIEW(code). Some view codes are:

0: Symbolic Screen
1: Plot Screen
2: Numeric Screen
3: Symbolic Setup Screen
4: Plot Setup
5: Numeric Setup
6: App Information (accessed by [Shift] [Apps])
7: Views Key (same as if you pressed the [Views])

-1: Home Screen
-2: Mode Setup Screen

Keyboard sequence for STARTVIEW is: [Shift] [Math] [ F1 ] [ 1 ] [ 3 ].

App Variables

App variables are global. Some are specific to one app while others are applicable to several apps. I usually type of the variables, but you can find the app variables by pressing [Vars] [ F2 ]. The order of the apps shift, with the current app on top. I will present some app variables. This is not the extensive list by any means, so please check out the HP 39gii manual for a complete list.

App Variables Specific to One App

Function Symbolic - There are ten functions that are named F#, with # representing a digit 0 through 9. F1 is at top of the Symbolic view, F0 is at the bottom.

Parametric Symbolic - Similar to Function; names are X1 - X9, X0 and Y1 - Y9, Y0.

Polar Symbolic - Similar to Function; names are R1 - R9, R0

Sequential Symbolic - Similar to Function; names are U1 - U9, U0

Solve Symbolic - you can store ten equations in the solve variables E1 - E9, E0

You can store graphing expressions and equations to the appropriate variable by using a string around your expression/equation. You can use both methods of storing (store arrow and the equals-colon assignment syntax) Examples:

"SIN(X^2)" → F1 (store to Function F1)
E3 := "A^2 + B^2 = C^2" (store to Equation E3)

Statistics - 1 Variable:
Data: D1 - D9, D0 (lists)
Analysis: H1 - H5
Set the sample by the command SetSample(H#, D#);

Statistics - 2 Variable:
Data: C1 - C9, C0 (lists)
Analysis: S1 - S5
Set the data to be analyzed by the commands:
SetIndep(S#, C#);
SetDepend(S#, C#);

App Variables used by Several Apps

The Plot window: Xmin, Xmax, Ymin, Ymax, Xscl, Yscl, Tmin, Tmax, Tstep, θmin, θmax, θstep

Three ways to access θ:
1. Be in Polar mode and press [X,T,θ,N].
2. Echo θ from the Characters Menu: [Shift] [Vars] [ F2 ] [ 7 ] (Greek and Coptic) [ F4 ] (Page Down) [ left ] [ left ] [ up ] [ up ] [ F6 ] (OK)
3. char(952) returns "θ" while expr(char(952)) returns θ.

CHECK and UNCHECK

CHECK turns a certain equation/expression on. UNCHECK, as you probably guessed, turns named function off.

Syntax:
CHECK(n)
UNCHECK(n)

Just the number is accepted: n refers to the equation/expression listed in the current app. Despite what the manual says, CHECK (F1) produces an error, n must be numerical.

With that long intro done, let's get to the programming!

The Program SSAT (Simple Statistics)

SSAT takes a list, turns on the Statistics 1-Variable app, and returns:

* The number of elements in the list
* The mean
* The standard deviation

After the results are displayed, you are returned to the home screen.

Note: The commands SetSample and Do1VStats are found in then Command-App-Statistics 1 Variable menu. ([Shift] [Math] [ F2 ])

Program:
EXPORT SSTAT(D)
BEGIN
D1:=D;
STARTAPP("Statistics 1Var");
SetSample(H1,D1);
Do1VStats(H1);
PRINT();
PRINT("n="+Nbltem);
PRINT("Mean="+MeanX);
PRINT("SDev="+sX);
STARTVIEW(-1);
END;


Example:
SSTAT({3,4.5,4.4,4.6,4,3.9,3.8,3,3.2}) returns

n=9
Mean=3.822222222
SDev=.630035272381

The Program PLOTF

The program PLOTF takes three arguments.

PLOTF(function of X as a string, left limit, right limit)

The function F0 is turned on while the other functions F1 - F9 are turned off. The Function app is tuned on the program terminates at the plot screen.

Program:
EXPORT PLOTF(f,a,b)
BEGIN
LOCAL c,d,K;
STARTAPP("Function");
Xmin:=a;
Xmax:=b;
c:=0;
d:=0;
f → F0(X);
CHECK(0);
FOR K FROM 1 TO 9 DO
UNCHECK(K);
END;
FOR K FROM a TO b STEP (b-a)/256 DO
IF F0(K) < c THEN
c:=F0(K); END;
IF F0(K) > d THEN
d:=F0(K); END;
END;
Ymin:=c-1;
Ymax:=d+1;
Xtick:=10^(ROUND(LOG(b-a),0));
Ytick:=10^(ROUND(LOG(d-c),0));
STARTVIEW(1);
END;


Example: Plot y = 2x^3 - x + 0.5 from -5 ≤ x ≤ 5

PLOTF("2X^3-X+0.5",-5,5) gets this:

The Program PROJECTILE

PROJECTILE does the following:
1. Switch the 39gii to the Parametric app and Degrees mode
2. Determines the projectile's range and height. No air resistance is assumed. You determined whether you are working in: SI (meters) or US (feet).
3. The path of the projectile is graphed.


Input: PROJECTILE(initial height, initial velocity, initial angle in degrees)

The program will ask you to select the value of the gravitational constant:
g = 9.80665 m/s^2
Or
g = 32.17405 ft/s^2

Program:
EXPORT PROJECTILE(y0, v0, a0)
BEGIN
LOCAL K;
STARTAPP("Parametric");
CHOOSE(K,"g=","9.80665 m/s²","32.17405 ft/s²");
IF K==0 THEN KILL; END;
IF K==1 THEN G:=9.80665; END;
IF K==2 THEN G:=32.17405; END;
HAngle:=1;
I:=y0;
V:=v0;
A:=a0;
"V*COS(A)*T" → X0(T);
"I+V*SIN(A)*T-0.5*G*T²"→Y0(T);
CHECK(0);
FOR K FROM 1 TO 9 DO
UNCHECK(K); END;
W:=FNROOT(Y0(T)=0,T,10);
R:=X0(W);
S:=FNROOT(X0(T)=R,T,10);
H:=(V²*(SIN(A))²)/(2G);
Xmin:=0;
Xmax:=R+2;
Ymin:=-1;
Ymax:=H+2+I;
Tmin:=0;
Tmax:=S;
Tstep:=S/240;
MSGBOX("Range: "+R);
MSGBOX("Height: "+H);
STARTVIEW(1);
END;


Example:

Initial height=2.1 ft
Initial velocity=56.5 ft/s
Initial angle=46.76°

PROJECTILE(2.1,56.5,46.7), select g=32.17405 ft/s^2

Results: (in feet)
Range: 100.984422673
Height: 26.2756069802

This concludes Part 7 of the HP 39gii programming tutorial. Until next time,

Eddie

Have a great day! Much happiness!


This blog is property of Edward Shore. 2013

Monday, April 1, 2013

HP 39gii Programming Tutorial Part 6: Making programs interactive with GETKEY

Welcome to Part 6 of the HP 39gii programming tutorial. In today's session, it is all about GETKEY. The GETKEY command allows programs to be interactive during execution.

GETKEY and Key Codes

Keystroke sequence for GETKEY:
[SHIFT] [Math] [ F1 ] [ 5 ] [ 5 ]

GETKEY returns the key number of the last key pressed. If there has not been a key pressed, GETKEY returns -1.

GETKEY assigns a key code to each of the keys, starting with 1 on the upper left corner of the keyboard, the [ F1 ], going right then down, to the lower right corner of the keyboard, [ENTER], which has code 50.

The key codes for the arrow keys are as follows:
[ up ] : 9
[ right ] : 10
[ left ] : 14
[ right ] : 15

Below is the map of key codes. (Source: HP 39gii User's Guide, Edition 1)

How to use GETKEY

In today's tutorial, we will demonstrate two uses of GETKEY:

1. Execute commands until any key is pressed.

General structure:
WHILE GETKEY==-1 DO
(Commands)
END;

2. Assign certain actions to certain keys.

Let E be the code for the exit key. Press the key that has the corresponding code E, and the loop ends.

REPEAT
...
GETKEY:=K;
....
IF K==(number) (and/or other conditions) THEN
(do this); END;
...
UNTIL K==E;

Let's demonstrate this in a couple of programs.

The Program SPIN1

Spinning Game #1: Use GETKEY to repeat an action until a key (any key is pressed)

Three spinners spin between 0 and 4. Press any key at any time and try to get the highest score possible.

EXPORT SPIN1()
BEGIN
RANDSEED();
RECT();
TEXTOUT_P("Ready!",1,1);
WAIT(0.5);
WHILE GETKEY==-1 DO
RECT();
INT(RANDOM(0,5))→A;
INT(RANDOM(0,5))→B;
INT(RANDOM(0,5))→C;
TEXTOUT_P(string(A),60,53);
TEXTOUT_P(string(B),145,53);
TEXTOUT_P(string(C),230,53);
WAIT(0.25);
END;
A+B+C→S;
TEXTOUT_P("Your score is "+string(S)+".",1,73);
WAIT(0);
END;


The MOVEM Program

The program MOVEM uses GETKEY to make an interactive program. Use the arrow keys to move the "M" character around. Exit the program with by pressing the [ F6 ] key.

The characters of the large font has a size of 10 x 12 pixels.

To erase a character at a position, use
TEXTOUT_P(character, x, y, font size, 3)

The last 3 tells the 39gii to type the character in white. This is necessary to give the "M" movement in MOVEM.

EXPORT MOVEM()
BEGIN
RECT();
A:=100;
B:=60;
REPEAT
TEXTOUT_P("M",A,B,2);
K:=GETKEY;
IF K≠1 THEN
TEXTOUT_P("M",A,B,2,3);
END;
IF K==14 AND A>0 THEN
A:=A-10; END;
IF K==10 AND A<240 THEN
A:=A+10; END;
IF K==15 AND B<108 THEN
B:=B+12; END;
IF K==9 AND B>0 THEN
B:=B-12; END;
UNTIL K==5;
END;


The screen shot below shows MOVEM in action. The can be a base for a simple game.

Next time, in Part 7, we'll show you how to use App commands in a program.

This blog is property of Edward Shore. 2013

TI-84+ Color Silver Edition vs Casio Prizm Color Command Comparison


Hello everyone! Is it April already? I could swear 2013 just started.

This is just a comparison between two graphing calculators: TI-84+ Color Silver Edition (TI-84+ CSE) vs Casio Prizm (fx-CG 10/20) Color Command Comparison. I own one of both models (no joke!) and enjoy using them. But it's fun to compare the two - even if it is out of pure curiosity.

Year of first release:
Casio Prizm: 2011
TI-84+ CSE: 2013

Colors Available:

Casio Prizm, 8 colors: Black, Blue, Red, Magenta, Green, Cyan, Yellow, White

TI-84+ CSE, 15 colors: Blue, Red, Black, Magenta, Green, Orange, Brown, Navy, Light Blue, Yellow, White, Light Gray, Medium Gray, Gray, Dark Gray

How to access the colors:
Casio Prizm: [SHIFT] [ 5 ] (FORMAT)
TI-84+ CSE: Either the last sub-menu of the VARS menu or if you are in program editing mode, the third sub-menu of the PRGM menu

Here are some of the programming commands that use color:

Output Text - Terminal/Home Screen:
Casio Prizm:
color "Text" (◢ if desired)
color Locate row, col, "text"

TI-84+CSE:
N/A

Text on the Graph Screen:
Casio Prizm: 187 × 379
color Text row, column, "text"/expression

TI-84+ CSE: 265 × 165
TextColor(color)
Text(row, column, "text"/expression)

Drawing Lines: (Points)
Casio Prizm:
Plot/Line-Color color
FLine x1, y1, x2, y2

TI-84+ CSE
Line(x1,y1,x2,y2,color)

Drawing Circles: point (x,y) with radius r
Casio Prizm:
color Circle x,y,r

TI-84+ CSE:
Circle(x,y,r,color)

Plotting Functions
Casio Prizm:
"f(X)"→Y# (Y from the VARS GRAPH menu)
Set-G Color color, #
DrawGraph

TI-84+ CSE:
"f(X)" → Y# (Y from the VARS Y-VARS menu)
GraphColor(#, color)
DispGraph


Happy programming and graphing!


Eddie


This blog is property of Edward Shore. 2013