Thursday, January 18, 2018

App Review: SciPro Calculator (Apple iOS)

App Review:  SciPro Calculator (Apple iOS)

Title:  SciPro Calc
Author:  Jerry Montgomery, Digital Ambience, Inc
Platform:  iOS
Price: Free (as of 1/18/2018)
Version:  1.2.5  (2017)



Portrait Orientation:  Basic Calculator

In the portrait orientation, SciPro Calculator is a basic function calculator.  The screen is impressive.  The black display clearly shows the large blue numbers and function indicators.  There is only 1 memory, but you get M+, M-, MC, and MR all on separate keys, which is nice.  You can turn the AC key into an AC/backspace key in Basic mode throughout the options.

Scroll down will give you access to the calculator’s history, allowing to view and copy results, even share them by email. 

Landscape Orientation:  Scientific and Programmer Calculator

Scientific Calculator



The calculator follows a post-fix algebraic system (think of a Texas Instruments TI-30 Xa or a Casio fx-260 II as examples).  The SciPro Calculator app can handle        numbers as high as 10^9864, which is very impressive.  

Functions include:

* trigonometry and their inverses (sine, cosine, tangent)
* hyperbolic functions
* factorial, which handles all real numbers not just integers (nice!)
* logarithms and exponentials, base e, 2, and 10
* square root, cube root, power, root
* modulus (see note below)
* Two angle modes: degrees, radians

Modulus Function

The modulus function works well on positive numbers.  Comparing results using negative numbers to an HP Prime:

78 mod -11:

HP Prime:  -10
SciPro Calculator:  1


-78 mod 11:

HP Prime: 10
SciPro Calculator: -1

The scientific app does lack fractions and statistics.  Other than that, it’s a good standard scientific calculator.

Programmer Calculator



The programmer calculator is a Boolean math calculator with four integer representations:  Binary (64 bits), Octal, Decimal, and Hexadecimal.  Depending on whatever mode you are in, the numeric keyboard highlights only the appropriate keys, so there is no accidently typing A in Decimal mode or 9 in Octal mode.



The ENC key turns on a unique feature, binary numbers which will give you the ASCII character, Unicode character, and the color determined by the RGB color.  This is most useful when the calculator is Hexadecimal representation.  You can use the arithmetic and the other functions to work with colors.  Sweet!

Functions featured in the Programmer Calculator:

*  Byte and Word Flip
*  Bit count and shift
*  Random integer
*  Boolean operators:  AND, OR, NOR, XOR
*  Modulus
*  1’s and 2’s compliments (Yes, there is a difference)

The programmer calculator can handle integers as high as:  18,446,744,073,709,551,615.

Caution:  No Sign Bit

Be aware that there are no sign bits with this calculator, everything is positive integer representation.  Hence this why 0 – 1 returns 18,446,744,073,709,551,615 (64 1s in Binary) instead of -1. 

Impressions

I like the unique feature of the programmer calculator having the ability to look up ASCII, Unicode, and RGB codes.  It’s a fun feature.

You probably won’t have to worry if you have to work with large numbers (at least numbers 10^100 and beyond), the SciPro Calculator app can handle it.

The blue numbers against the black screen is really nice, big, and readable, regardless of orientation of your iPhone or iPod Touch.

This is a nice calculator to have, especially for quick calculations.


Eddie

This blog is property of Edward Shore, 2018

Tuesday, January 16, 2018

TI-74: Extrema of a Cubic Polynomial

TI-74: Extrema of a Cubic Polynomial

Introduction

The program finds the extrema points of a cubic polynomial where the roots A, B, and C are known.  The cubic polynomial is defined as:

y = (x – A) * (x – B) * (x – C)




Expanded to:

y = x^3 – (A + B + C)*x^2 + (A*B + B*C + A*C)*x – (A*B*C)

The extrema can be found by taking the derivative and then solving for x when dy/dx=0.

dy/dx = 3*x^2 – 2*(A + B + C)*x + (A*B + B*C + A*C) = 0

Solving for x:

x = (2*W ± √(4*W^2 – 12*V))/6

Where:

W = A + B + C
V = A*B + A*C + B*C

TI-74 Program: Extrema of Cubic Polynomials

100 PRINT “y=(x-a)(x-b)(x-c)”: PAUSE 1
110 INPUT “a: “;A
112 INPUT “b: “;B
114 INPUT “c: “;C
120 W=A+B+C
122 V=A*B+A*C+B*C
130 X1=(2*W+SQR(4*W^2-12*V))/6
132 X2=(2*W-SQR(4*W^2-12*V))/6
140 Y1=(X1-A)*(X1-B)*(X1-C)
142 Y2=(X2-A)*(X2-B)*(X2-C)
150 IMAGE “######.######, ######.######”
152 PRINT USING 150,X1,Y1: PAUSE
154 PRINT USING 150,X2,Y2: PAUSE
160 END

Example

A = 0, B = 3, C = 5

Results:
4.119633, -4.06067
1.213700, 8.20882

Eddie


This blog is property of Edward Shore, 2018

Sunday, January 14, 2018

Curve Fitting: Fitting to the Curve y = a*e^(-b*x^2)

Curve Fitting:  Fitting to the Curve y = a*e^(-b*x^2)

Introduction

This blog is to fit data to the equation y = a*e^(-b*x^2).  A famous example is the equation:

y = 2/(π) * e^(-x^2)

which the indefinite integral of 0 to real number t is the basis of the error function. 

Turning y = a*e^(-b*x^2) into a Linear Form

y = a*e^(-b*x^2)

ln y = ln (a*e^(-b*x^2))

ln y = ln a + (-b)*x^2

Y’ = A’ + B’ * x^2

Where:  Y’ = ln y,  A’ = ln a, B’ = -b

Results:  e^A, B

Inputs:  square each of the data points of X, take the natural logarithm for Y.

Example

I use the HP Prime for this example. 

Fit the data below to the curve y = a*e^(-b*x^2).

x
y
-0.75
0.642931
-0.35
0.998284
0
1.128379
0.35
0.998284
0.62
0.768267
0.94
0.466951

Adjust data:

x
C1 = x^2
y
C2 = ln y
(to 6 decimal places)
-0.75
0.5625
0.642931
-0.441718
-0.35
0.1225
0.998284
-0.001717
0
0
1.128379
0.120782
0.35
0.1225
0.998284
-0.001717
0.62
0.3844
0.768267
-0.263618
0.94
0.8836
0.466951
-0.761531

Running the linear_regression(C1^2, LN(C2)) returns the matrix [B’, A’]:

[-0.998758, 0.120567]

The results must be adjusted: e^(.120567) = 1.128136

Final adjusted curve:  y ≈ 1.128136 * e^(-0.998758*x^2)

Using the Exponential Regression Model

We can use exponential regression function as an alternative to the linear regression. 

For the input, square all of the x data.

x
C1 = x^2
C2 = y
-0.75
0.5625
0.642931
-0.35
0.1225
0.998284
0
0
1.128379
0.35
0.1225
0.998284
0.62
0.3844
0.768267
0.94
0.8836
0.466951

The function exponential_regression from the HP Prime that fits data to the model y = B * A^x. 

To fit this model asked, y = a*e^(-b*x^2), we will need to take the natural logarithm of B. 

Hence:  exponential_regression(C1^2, C2) returns

[0.368337, 1.128136]

With ln(0.368337) ≈ -0.998757, the required equation is

y = 1.128136*e^(-0.998757*x^2)

Summary

To fit data to the curve y = a*e^(-b*x^2):

Linear Regression, Y’ = A’ + B’*X’
Exponential Regression, Y’ = B’*A’^X’
Input:  X’ = x^2, Y’ = ln y
Output:  a = e^A’, b = B’
Input: X’ = x^2, Y’ = y
Output: a = A’, b = ln(B’)

Eddie


This blog is property of Edward Shore, 2018.

Friday, January 12, 2018

TI-80 and TI-84 Plus CE – Two Opposing Ocean Waves

TI-80 and TI-84 Plus CE – Two Opposing Ocean Waves

Introduction

The program OPPTIDE draws an ocean wave consisting of a composite of two opposite waves at time t seconds. 

Inputs:

L = wavelength of the wave in feet (λ)
A = amplitude of the wave in feet
H = depth of the ocean in feet
T = time that the wave is drawn, in seconds

Constants:

G ≈ 32.174049 ft/s^2  (approximate Earth’s gravitation constant)

Output: 

Drawing of the wave described by the equation:

y = A cos (K*X – W*T) + A cos (K*X + W*T)  (X varies, T is a constant and given), where:
K = 2*π/L
W = (g*K*tanh(K*H))

Note:

The tanh, hyperbolic tangent function, is not on the TI-80.  Therefore the following definition is used:

tanh x = (e^(2*x) – 1)/(e^(2*x) + 1)

The tanh function is found only in the catalog of the TI-84 Plus CE ([Shift], [ 0 ]).

TI-80 Program OPPTIDE

DISP “2018-01-10 EWS”
RADIAN
0→XMIN
50→XMAN
5→XSCL
32.17049→G
DISP “FEET”
INPUT “WAVELENGTH:”,L
INPUT “DEPTH:”,H
INPUT “AMPLITUDE:”,A
-A-1→YMIN
A+1→YMAX
1→YSCL
INPUT “TIME:”,T
(2π)/L→K
(e^(2KH)-1)/(e^(2KH)+1)→Q
√(QKG)→W
“A*COS(KX-WT)+A*COS(KX+WT)”→Y1
DISPGRAPH

TI-84 Plus CE Program OPPTIDE

“EWS 2018-01-10”
Func: Radian
0→Xmin: 50→Xmax: 5→Xscl
32.174049→G
Disp “DISTANCE IN FEET”
Input “WAVELENGTH:”, L
Input “AMPLITUDE:”, A
-A-1→Ymin: A+1→Ymax: 1→Yscl
Input “OCEAN DEPTH:”, H
Input “TIME (S):”, T
2π/L→ K
√(G K * tanh(KH))→W
“A cos(KX – WT) + A cos(KX + WT)” → Y1
GraphColor(1,BLUE)
DispGraph

Example

At T = 1 second with parameters:
W = 75.5 feet
A = 4.76 feet
H = 25 feet

See the results below.



Source:

Salmon, Rick.  “Intro to Ocean Waves”  Scripps Institution of Oceanography.  UC San Diego  December 7, 2015.  http://pordlabs.ucsd.edu/rsalmon/111.textbook.pdf  Retrieved December 26, 2017

Eddie


This blog is property of Edward Shore, 2018.  

Saturday, January 6, 2018

Star Wars and Calculators

Star Wars and Calculators?

Yes, you read that correctly.  It turns out that in the classic 1977 movie Star Wars IV – A New Hope, Luke Skywalker’s (played by Mark Hamill) lightsaber contains a part found in calculators (at the time).  That part was a seven-bulb bubble lens LED module, which was attached to a Graflex flash. 

Several known calculators had this bubble lens module in its display, such as the Exactra 19 and Exactra 20 calculators.   The Exactra models, manufactured by Texas Instruments, were made in request for more affordable calculators by the Ohio State University..

For more details click on the links below: 

“Star Wars IV – A New Hope (1977)” – Joerg Woerner

“Lightsaber Skywalker” – Chris Trevas and Chris Reiff
Link: http://www.partsofsw.com/skysab.htm

Full credit goes to the authors (Woerner, Trevas, and Reiff).  

It is really cool to know that a calculator contributed to saving our galaxy from the dark side.

And may all the calculations be with you.


Eddie

This blog is property of Edward Shore, 2018. 

Thursday, January 4, 2018

HP Prime: Black Hole Characteristics – Hawking Radiation

HP Prime:  Black Hole Characteristics – Hawking Radiation

Equations Used

Given the mass (either in kg or solar masses), the following equations can estimate these black hole characteristics:

Swartzchild Radius (in m): 
R = M * G/c^2

Life time left as the black hole slowly radiates (in s):
t = M^3 * 5120 * π * G^2 / (hbar * c^4)

The HP Prime uses the conversion for seconds to years:
1 year ≈ 31556925.9747 s

Average temperature of the black hole (K):
temp = (hbar * c^3)/(M * 8 * k * π * G)

If you need to convert to °C subtract 273.15 from this result.

Surface area of the black hole (m^2):
sa = (M^2 * 16 * π * G^2)/c^4

Surface gravity of the black hole (m/s^2), as you can imagine, this will be a huge number:
gr = c^4 / (M * 4 * G)

Constants Used

Values are taken from the HP Prime

Universal Gravitation Constant
G = 6.67384 * 10^-11 m^3/(kg * s^2)

Speed of Light
c = 299792458 m/s

Plank Constant Divided by 2*π
hbar = 1.054571726 * 10^-34 J*s

Boltzmann Constant
k = 1.3806488 * 10^-23 J/K



HP Prime Program BLACKHOLE

EXPORT BLACKHOLE()
BEGIN
// EWS 2018-01-04
// Hawking Radiation

// Input of mass
LOCAL ch,M;
INPUT({M,{ch,{"kg","Solar Mass"}}},
"Mass",{"Mass: ","Unit: "});

IF ch:=2 THEN
M:=1.988435ᴇ30*M;

END;

LOCAL k,G,c,hbar;
// from 4 Constants
// Shift, Units, Constant
k:=1.3806488ᴇ−23; // Chemistry
G:=6.67384ᴇ−11; // Physics
c:=299792458; // Physics
hbar:=1.054571726ᴇ−34; // Quantum

// Swartzchild radius (m)
LOCAL R:=(2*G*M)/c^2;

// Life (years)
LOCAL t:=M^3*5120*π*G^2/
(hbar*c^4*31556925.9747);

// Temperature (K)
LOCAL temp:=(hbar*c^3)/
(M*8*k*π*G);

// Surface Area (m^2)
LOCAL sa:=M^2*16*π*G^2/c^4;

// Gravity
LOCAL gr:=c^4/(4*G*M);

// Results
PRINT();
PRINT("Schwartzchild Radius:");
PRINT(R+" m");
PRINT("Life:");
PRINT(t+" years");
PRINT("Temperature:");
PRINT(temp+" K");
PRINT("Surface Area:");
PRINT(sa+" m^2");
PRINT("Surface Gravity:");
PRINT(gr+" m/s^2");


// List
RETURN {R,t,temp,sa,gr};
END;

Examples

Cygnus X-1:  14.8 solar masses

Schwartzchild Radius: 43705.6410566 m
Life:  6.79261706057 * 10^70 years
Temperature:  4.16932978074 * 10^-9 K  (near absolute zero, very cold!)
Surface Area:  24004068275.4 m^2
Surface Gravity: 1.02819127807 * 10^12 m/s^2

Sagittarius A*, the center of our Milky Way Galaxy:  4.31 million solar masses

Schwartzchild Radius: 12727791415.8 m
Life: 1.67758214773 * 10^87 years
Temperature: 1.43169560917 * 10^-14 K
Surface Area: 2.03571024785 * 10^21 m^2
Surface Gravity: 3530680.02679 m/s^2

Source:

Jim Wisniewski.  “Hawking Radition Calcualtor”  Xaonon.  January 3, 2017.  http://xaonon.dyndns.org/hawking/  Retrieved December 26, 2017

Eddie


This blog is property of Edward Shore, 2018.

Fun with Triangle and Square Numbers

Fun with Triangle and Square Numbers

Formulas

Triangle Numbers:

Tn = COMB(n +1, 2) = (n^2 + n)/2

Square Numbers:

Sn = n^2

where n is an integer, n ≥ 1

Mathematics between Triangle and Square Numbers

2*Tn

2*Tn = 2 * (n^2 + n)/2 = n^2 + n = Sn + n

Note that 2*Tn is a rectangle number, which consists of a square with a row or column attached to it.  2*Tn is an integer. 

3*Tn

3*Tn = 3 * (n^2 + n)/2

We can show that 3*Tn is an integer by showing that 3*Tn is an integer for both even and odd n. 

First assume that n is even, let n = 2*k and k is a positive integer:

3 * Tn
= 3/2 * ((2*k)^2 + 2*k)
= 3/2 * (4*k^2 + 2*k)
= 3 * (2*k^2 + k)
The result is an integer.

Next, let n be an odd integer of the form of n = 2*k + 1.  Then

3 * Tn
= 3/2 * ((2*k + 1)^2 + (2*k + 1))
= 3/2 * (4*k^2 + 4*k + 1 + 2*k + 1)
= 3/2 * (4*k^2 + 6*k + 2)
= 3 * (2*k^2 + 3*k + 1)
The result is an integer.

Tn^2

Tn^2 = (n^2 + n)/2)^2

Expanding Tn^2 to get:

= (n^4 + 2*n^3 + n^2)/4

Tn^2 in terms of Sn and n:

Tn^2
= (Sn^2 +2*n^3 + Sn)/4
= (Sn^2 + 2*Sn*n + Sn)/4
= (Sn^2 + Sn*(2*n + 1))/4

Clearly Tn^2 is an integer since Tn is an integer, and multiplying two integers generates another integer.

Square Numbers in terms of Triangle Numbers

With Sn = n^2 and Tn = (n^2 + n)/2

Tn = (n^2 + n)/2
Tn = (Sn + n)/2
2 * Tn = Sn + n
2 * Tn – n = Sn

Eddie


This blog is property of Edward Shore, 2018.  (Happy New Year!)

App Review: SciPro Calculator (Apple iOS)

App Review:  SciPro Calculator (Apple iOS) Title:  SciPro Calc Author:  Jerry Montgomery, Digital Ambience, Inc Platform:  iOS P...