Saturday, December 9, 2023

Swiss Micros DM32 and Casio fx-4000P: Prime Factorization

Swiss Micros DM32 and Casio fx-4000P:   Prime Factorization



Introduction 



On March 22, 2017, I posted a prime factorization program for the HP 15C:


https://edspi31415.blogspot.com/2017/03/hp-15c-prime-factorization.html



Today's blog is a port for the:


* Swiss Micros DM32 (and HP 32SII family)

* Casio fx-4000P



Swiss Micros DM32 Code:  Prime Factorization



Instructions:


1.  Enter a positive integer on the X stack. 

2.  Run the program (XEQ P) and a prime factor is displayed.  Press [ R/S ] to continue.  At this point the calculator is set to FIX 0 mode.   Repeat step 2.

3.  The program ends when the integer reappears.  The calculator is reset to FIX 4.  


3 labels are needed.



P01  LBL P

P02  FIX 0

P03  STO B

P04  STO A

P05  2

P06  STO F


B01  LBL B

B02  RCL A

B03  RCL÷ F

B04  ENTER

B05  FP

B06  x=0?

B07  GTO A

B08  1

B09  STO+ F

B10  GTO B


A01  LBL A

A02  RCL F

A03  STOP

A04  R↓

A05  R↓

A06  STO A

A07  1

A08  -

A09  x≠0?

A10 GTO B

A11 RCL B

A12 FIX 4

A13 RTN



Labels used:  P, B, A

Variables:  F (factor), A, B





Casio fx-4000P Code: Prime Factorization



Instructions:


1.  Run program (P#) in RUN Mode (Mode 1).  

2.  Enter a positive integer at the "N?" prompt.  

3.  A prime factor is displayed.  Press [ EXE] to continue. Repeat step 3.

4.  The program ends when the integer reappears.  



"N" : ? → N : N → T : 2 → F : 

Lbl 3 : Frac( T ÷ F ) = 0 ⇒ Goto 2 :

F + 1 → F : Goto 3 :

Lbl 2 : F ◢ T ÷ F → T : T - 1 ≠ 0 ⇒ Goto 3 : N


Variables:  N, T, F  




Examples


26:  2, 13, 26   (26 = 2 × 13)


89:  89   (89 is prime)


175:  5, 5, 7, 175   (175 = 5^2 × 7)


1020:  2, 2, 3, 5, 17, 1020  (1020 = 2^2 × 3 × 5 × 17)




Eddie


All original content copyright, © 2011-2023.  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. 


Sunday, December 3, 2023

Casio fx-5000F: Auto Formulas

Casio fx-5000F:   Auto Formulas



The formula listing can apply to (almost) any calculator that can handle formula programming.


In November, there I want to a luncheon that a local car club had in Riverside.  Of course, this was an opportunity to bring a calculator and find something in common with the members.   I previously did this with a TI-68.


Except noted, US, imperial units are used.  


The source for all the equations are from The Auto Math Handbook, except for Gas Efficiency.  




Stroke of an Engine

(spaces added for readability)


S = D / ( π / 4 × B^2 × n ) = D / ( π / 4 × B² × n )


S = stroke (in)

D = displacement (in^3)

B = bore (in)

n = number of cylinders


Example:

D = 421

B = 4 

n = 6


Result: 

S ≈ 5.58369 in 



Engine Horsepower


H = R × T × 2 × π / 33000


H = engine horsepower (hp)

R = revolutions per minute (rpm)

T = torque (lbs-ft)


Example:

R = 5200 

T = 446


Result:

H ≈441.57465



Theoretical Air Capacity of an Engine


C = R × D / 3456


C = air capacity (in^3/min [cubic feet per minute])

R = revolutions per minute (rpm)

D = displacement (in^3)


Example:

R = 5200

D = 421 


Result:

C ≈ 633.44907



Estimated Elapsed Time in a Quarter Mile


The time is based off an engine's weight (really, mass) and horsepower.


E = 5.825 × ³√( W / H ) = 5.825 × ( W / H )^(1/3)


E = elapsed time in seconds (sec)

W = weight of the automobile/truck (pounds)

H = horsepower of the engine (hp)


Example:

W = 3676 

H = 440


Result:

E ≈ 11.81962



Gear Ratio 


This estimates the final gear ratio.  Note that 63360 ÷ 60 = 1056, allowing a simplified formula to be used.


G = R × T × θ / M / 1056


G = gear ratio

R = revolutions per minute (rpm)

T = tire diameter (in)

M = miles per hour (mph) (average)


Example:

R = 5200

T = 28

M = 57.8


Result:

G ≈ 7.49410



Tire Diameter


T = W × A / 1270 + R


Take the following measurements as they are marked on the tire:


[LT/P]  W / A  [R/B]   R


W = section width (mm:  yes, somehow U.S. tires measure this in millimeters)

A = aspect ratio (percentage difference between section height and section width)

R = rim diameter (in)


T = tire diameter (in)


Example:

W = 235

A = 75

R = 15


Result:

D ≈ 28.87795



Gas Efficiency


M = (B - A) / g


B = ending mileage (mi)

A = beginning mileage (mi)

g = number of gallons used


M = gas efficiency (mpg, miles per gallon)


Example:

B = 13695

A = 13385

G = 10


Result:

M = 31



Source


Lawlor, John.   Auto Math Handbook:  Calculations, Formulas, Equations and Theory  HPBooks  New York, NY 1992.



Eddie


All original content copyright, © 2011-2023.  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, December 2, 2023

Swiss Micros DM41X and Numworks: Fresnel Reflection Calculations

Swiss Micros DM41X and Numworks:  Fresnel Reflection Calculations



Introduction



Given the following:


ni:  incident refractive index  (input)


nt:  incident transmitted index (output)


θi:  angle of incidence, in degrees



The following are calculated:



θt:  angle of transmission, in degrees


θt = arcsin(ni × sin θi ÷ nt)



θb:  angle as determined by Brewster's law


θb = arctan(nt ÷ ni)



R:  power reflectance coefficient


R = (ni - nt)^2 ÷ (ni + nt)^2



T:  power transmitted coefficient


T = 1 - R




Swiss Micros DM41X Code:   FRES


01  LBL^T FRES

02  DEG

03 ^T N.I?

04  PROMPT

05  STO 01

06  CLA

07  29

08  XTOA

09  ^T |- .I?

10  PROMPT

11  STO 03

12  ^N.T?

13  PROMPT

14  STO 02

15  RCL 01

16  RCL 02

17  /

18  RCL 03

19  SIN

20  *

21  ASIN

22  STO 04

23  CLA

24  29

25  XTOA

26  ^T |- .T=

27  ARCL 04

28  AVIEW

29  STOP

30  RCL 02

31  RCL 01

32  /

33  ATAN

34  STO 05

35  CLA

36  29

37  XTOA

38  ^T |- BRW=

39  ARCL 05

40  AVIEW

41  STOP 

42  RCL 01

43  RCL 02 

44  -

45  RCL 01

46  RCL 02

47  +

48  /

49  X↑2

50  STO 06

51  ^T R=

52  ARCL X

53  AVIEW

54  STOP

55  1

56  X<>Y

57  -

58  STO 07

59  ^T T=

60  ARCL X

61  AVIEW

62  END  



Numworks - Python Code:  fres.py


from math import *

print("Fresnel Equations")

print("Electrical Fields")

print("(angles are in degrees)")


ti=float(input("\u03b8.i? "))

ai=radians(ti)


ni=float(input("n.i? "))

nt=float(input("n.t? "))


at=asin(ni/nt*sin(ai))

tt=degrees(at)


ab=atan(nt/ni)

tb=degrees(ab)


r=((ni-nt)/(ni+nt))**2

t=1-r



print("\n\u03b8.t =",tt)

print("Brewster's Law=\n",tb)

print("Reflect Coef.=\n",r)

print("Trans. Coef.=\n",t)



Example


Inputs:  

θi: 46°

ni: 1.33

nt: 1.5


Outputs:

θt ≈ 39.6291°

θb ≈ 48.4377°

R ≈ 0.0036

T ≈ 0.9964



Sources


R. Paschotta, article on 'Fresnel equations' in the RP Photonics Encyclopedia, accessed on 2023-11-04.  URL:  https://www.rp-photonics.com/encyclopedia_cite.html?article=Fresnel%20equations


Woan, Gaham.   The Cambridge Handbook of Physics Formulas  2003 Edition. Cambridge University Press.  2000. ISBN 978-0-511-07589-6



Eddie


All original content copyright, © 2011-2023.  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. 


Sunday, November 26, 2023

DM42/HP 42S: Most Probable Position

DM42/HP 42S:  Most Probable Position



Introduction


The program MPP calculates an adjusted latitude (+N, -S) and adjusted longitude (+W, -E) of an observer:  


*  The latitude and longitude of the observer's dead reckoning.  

*  The computed altitude and azimuth (N = 0°, E = 90°, S = 180°, W = 270°).

*  The height of the sextant held by the observer.  


The most probable position is calculated by:


Calculated latitude:


LAT* = L - (Hc - H0) × cos(Z)


Calculated longitude:  


LON* = λ - ( (H0 - Hc) × sin(Z) ÷ cos(L) )


where


L =  dead reckoning latitude 

λ =  dead reckoning longitude

Hc = computed altitude of the celestial object

Z = zenith of the celestial object

H0 = correct sextant height


L, λ, Hc, H0 are customarily entered in degrees-minutes or degrees-minutes-seconds format.   The program MPP requires the four variables to be entered in L, λ, Hc, and H0 to be entered in DDMM.m format (see the Instructions section).  



Instructions


Soft menu items are enclosed in parenthesis.


1.  Enter the longitude and latitude in DDMM.m format.   DD represents decimal degrees, MM represents the integer part of minutes, and .m represents the fractional part of minutes.  


Examples:


Enter 52°00'  as 5200.


Enter 17°16.56' as  1716.56.


Enter the longitude, press [ENTER], enter the latitude, then press (LA/LO).   North longitude is positive, west latitude is positive.


2.  Enter the altitude of the reference object (star, planet, sun, other celestial object) in DDMM.m format, press [ENTER], the object's zenith in degrees, then press (HC/Z).  


3.  Enter the correct sextant height in DDMM.m format, press (>H0).  The altitude intercept (Hc - H0) is displayed in miles.  (negative is towards, positive is away)


4.  Press (CALC) to get the computed latitude (LAT*), press [ R/S ] to get the computed longitude (LNG*).  


To exit the program, press (EXIT).  



DM42/HP 42S/Free42/Plus Code:  Most Probable Position


00 { 234-Byte Prgm }

01▸LBL "MPP"

02 DEG

03 "MOST PROBABLE"

04 AVIEW

05 PSE

06 "POSITION, HP 65"

07 AVIEW

08 PSE

09 "DDMM.m, +N, +W"

10 AVIEW

11 PSE

12▸LBL 30

13 "LA/LO"

14 KEY 1 XEQ 21

15 "HC/Z"

16 KEY 2 XEQ 22

17 ">H0"

18 KEY 3 XEQ 23

19 "CALC"

20 KEY 4 XEQ 24

21 "EXIT"

22 KEY 6 XEQ 26

23 MENU

24▸LBL 00

25 STOP

26 GTO 00

27▸LBL 21

28 XEQ 31

29 STO 07

30 X<>Y

31 XEQ 31

32 STO 02

33 GTO 30

34▸LBL 22

35 STO 05

36 X<>Y

37 XEQ 31

38 STO 04

39 GTO 30

40▸LBL 23

41 XEQ 31

42 STO 06

43 RCL 04

44 X<>Y

45 -

46 STO 01

47 XEQ 32

48 GTO 30

49▸LBL 31

50 →HMS

51 100

52 ÷

53 →HR

54 RTN

55▸LBL 32

56 →HMS

57 100

58 ×

59 →HR

60 RTN

61▸LBL 24

62 RCL 02

63 RCL 05

64 COS

65 RCL× 01

66 -

67 STO 03

68 XEQ 32

69 "LAT*="

70 ARCL ST X

71 AVIEW

72 STOP

73 RCL 07

74 RCL 05

75 SIN

76 RCL× 01

77 RCL 02

78 COS

79 ÷

80 +

81 1

82 →REC

83 →POL

84 X<>Y

85 STO 08

86 XEQ 32

87 "LNG*="

88 ARCL ST X

89 AVIEW

90 PSE

91 GTO 30

92▸LBL 26

93 CLMENU

94 EXITALL

95 .END.



Download mpp.raw:  

https://drive.google.com/file/d/1Jrs14guVv3wuYEMuFRYDq4N3MGHrICxL/view?usp=sharing 



Example


Data Given:

Latitude:  30°44' N

Longitude:  128°36' W

Computed Altitude of star:  21°40'

Azimuth of the star:  61°

Corrected Sextant:  19°32'


Enter:

3044 ENTER 12836 (LA/LO)

2140 ENTER 61 (HC/Z)

1932 (>H0)   


(CALC)  

LAT*=2941.57  (29°41.57' N)

LNG*=13046.25  (130°46.25' W)



Source


Hewlett Packard.  "NAV 1-20A:  MOST PROBABLE POSITION"  HP-65 Navigation Pac 1 1974.  pp. 64-65, 137




Eddie


All original content copyright, © 2011-2023.  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, November 25, 2023

HP 15C, DM42, HP 27S: Floor and Ceiling Functions

HP 15C, DM42, HP 27S:   Floor and Ceiling Functions



Notes :


HP 15C: includes  HP 15C, Original, Limited, and Collector's Edition, and apps

DM42: includes HP 42S, DM42, Free42, Plus42




Introduction:  Floor and Ceiling Functions


The floor and ceiling functions are two common functions that transfers a number to an integer.   



Floor Function



Floor:   The greatest integer that is less than or equal to x.  A common symbol for floor is |_x_| and a function call is floor(x).


Let int(x) be the integer part function (sometimes labeled intg(x) or lp(x)), and frac(x) be the fractional part function (sometimes labeled fp(x)).


#  x is an integer

If frac(x) = 0, then return floor(x) =  x     


# x is not an integer

If x ≥ 0, then return floor(x) = int(x)

If x < 0, then return floor(x) = int(x) - 1


Per the function.wolfram.com web page: an equivalent using the modulus function for floor(x) is:


floor(x) = x - x mod 1


Examples:


floor(2.8) = 2

floor(6) = 6

floor(-2.8) = -3



Ceiling Function


Ceiling:  The least integer that is greater than or equal to x.  A common symbol for ceiling is |-x-| (except the horizontal lines are the top) and a function call is either ceil(x) or ceiling(x).  


#  x is an integer

If frac(x) = 0, then return ceil(x) =  x     


# x is not an integer

If x ≥ 0, then return ceil(x) = int(x) + 1

If x < 0, then return ceil(x) = int(x) 


Per the function.wolfram.com web page: an equivalent using the modulus function for floor(x) is:


ceil(x) = x + (-x) mod 1


Examples:

ceil(2.8) = 3

ceil(6) = 6

ceil(-2.8) = -2



Calculator Code:  HP 15C, DM 42, HP 27S



HP 15C


Three labels are used:

D:  floor function

E:  ceiling function

1:  used in calculation for both  (roll stack down one extra time when frac(x)≠0)


step #:  key code : key


000:  42, 21, 14:  LBL D

001:  __, __, 36:  ENTER

002:  __, 42, 44:  FRAC

003:  __, 43, 20:  x=0

004:  __, 22, _1:  GTO 1

005:  __, __, 33:  R↓

006:  __, 43, 44:  INT

007:  43, 30, _3:  TEST 3  (x≥0)

008:  __, 43, 32:  RTN

009:  __, __, _1:  1

010:  __, __, 30:  -

011:  __, 43, 32:  RTN


012:  42, 21, 15:  LBL E

013:  __, __, 36:  ENTER

014:  __, 42, 44:  FRAC

015:  __, 43, 20:  x=0

016:  __, 22, _1:  GTO 1

017:  __, __, 33:  R↓

018:  __, 43, 44:  INT

019:  43, 30, _2:  TEST 2 (x<0)

020:  __, 43, 32:  RTN

021:  __, __, _1:  1

022:  __, __, 40:  +

023:  __, 43, 32:  RTN


024:  42, 21, _1:  LBL 1

025:  __, __, 33:  R↓

026:  __, 43, 32:  RTN






DM42/Free 42/HP 42S


00 { 16-Byte Prgm }

01▸LBL "FLOOR"

02 ENTER

03 ENTER

04 1

05 MOD

06 -

07 RTN

08 END


00 { 15-Byte Prgm }

01▸LBL "CEIL"

02 ENTER

03 +/-

04 1

05 MOD

06 +

07 RTN

08 .END.



HP 27S


FLOOR=X-MOD(X:1)


CEIL=X+MOD(-X:1)



Sources


Wolfram Research, Inc.   "Floor Function".  Path:  Integer Functions > Floor[z] > Representations through equivalent functions > With related functions.   Retrieved October 30, 2023.


https://functions.wolfram.com/IntegerFunctions/Floor/27/01/05/



Wolfram Research, Inc.   "Ceiling Function".  Path:  Integer Functions > Ceiling[z] > Representations through equivalent functions > With related functions.   Retrieved October 30, 2023.


https://functions.wolfram.com/IntegerFunctions/Ceiling/27/01/05/




Eddie


All original content copyright, © 2011-2023.  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, November 18, 2023

HP 32S and HP 15C: Synthetic Division

HP 32S and HP 15C:   Synthetic Division



These programs perform synthetic division, where a polynomial of degree n is divided by the binomial term x - x_0:


[a_n × x^n + a_(n-1) × x^(n-1) + a_(n-2) × x^(n-2) + ... a_1 × x + a_0] ÷ (x - x_0)


With the result of the division is:


[q_(n-1) × x^(n-1) + q_(n-2) × x^(n-2) + ... + q_1 × x + q_0] + R ÷ (x - x_0)


where: 


q_(n-1) = a_n

R is the remainder.



HP 32S/32SII:  Synthetic Division


The degree of the polynomial can go up to 24, with the variables set up as:


p(x) = [ A + B × x + C × x^2 + D × x^3 + ... + Y × x^24 ] ÷ (x - Z)


where

A is the constant

B is the coefficient of x

C is the coefficient of x^2 

and so on...

Z = x_0


Flag 1 is used as an indicator that there are coefficients q_k.  



Code:


S01  LBL S

S02  CF 1

S03  1

S04  +

S05  STO i

S06  SF 1

S07  RCL (i)

S08  STOP

S09  DSE i


Z01  LBL Z

Z02  RCL× Z

Z03  RCL+ (i)

Z04  STOP

Z05  DSE i

Z06  GTO Z

Z07  CF 1

Z08  RTN


Total Memory:  S:  13.5 bytes, Z:  12.0 bytes, Total:  25.5 bytes


To run:  store the coefficients and x0.  Enter the degree of the polynomial and press XEQ S.  



HP 15C:  Synthetic Division


The degree of the polynomial can go as high as you want, as long as you have registers.   The variables set up as:


p(x) = [ R0 + R1 × x + R2 × x^2 + R3 × x^3 + ... ] ÷ (x - R0)


where

R0 is the constant

R1 is the coefficient of x

R2 is the coefficient of x^2 

and so on...

R0 = x_0


Flag 8 is used as an indicator (C on the screen) that there are coefficients q_k.  In effect, this turns on complex mode, which would create a stack of imaginary numbers.  The complex mode for the HP 15C requires five registers to run.  


Code:


001  LBL A:   42,21,11

002  CF 8:  43, 5, 8

003  1:  1

004  +:  40

005  STO I:  44, 25

006  SF 8:  43, 4, 8

007  RCL (i):  45, 24

008  R/S:   31

009  DSE I:  42, 5, 25


010  LBL 0:  42, 21, 0

011  RCL× 0:  45, 20, 0

012  RCL+ (i):  45,40,24

013  R/S:  31

014  DSE I:  42, 5,25

015  GTO 0:  22, 0

016  CF 8:  43, 5, 8

017  RTN:  43,32


To run:  store the coefficients and x0.  Enter the degree of the polynomial and press GSB A.  



Examples



Example 1:  [ 4x^3 + 3x^2 + 2x - 5 ] ÷ [ x -  1 ]


HP 32S:

A:  -5,  B:  2,  C:  3,  D:  4,  Z:  1


HP 15C: 

R1:  -5,  R2:  2,  R3:  3,  R4:  4,  R0:  1


Degree: 3


3 XEQ S/GSB A:


Results:  

4   (x^2)  R/S

7   (x)   R/S

9   (constant)  R/S

4  (remainder)


4x^2 + 7x + 9 + 4 ÷ (x-1)



Example 2:  [ x^4 - 3x^2 + 6x + 3 ] ÷ [ x + 3 ]


HP 32S:

A:  3,  B:  6,  C:  -3, D:  0,  E:  1,  Z:  -3


HP 15C:

R1:  3,  R2:  6,  R3:  -3, R4:  0,  R5:  1,  R0:  -3


Degree:  4


4 XEQ S/GSB A


Results:

3   (x^3)  R/S

6   (x^2)  R/S

-3   (x)   R/S

0   (constant)  R/S

1  (remainder)


x^3 - 3x^2 + 6x - 12 + 39 ÷ (x + 3)



Example 3:  [ x^3 - 42x^2 + 395x + 966 ] ÷ [ x - 21 ]


HP 32S:

A:  966,  B:  395,  C:  -42,  D:  1,  Z:  21


HP 15C:

R1:  966,  R2:  395,  R3:  -42,  R4:  1,  R0:  21


Degree:  3


3 XEQ S/GSB A:


Results:  

1   (x^2)  R/S

-21   (x)   R/S

-46   (constant)  R/S

0 (remainder)


x^2 - 21x - 46



Source


Hewlett Packard.  "Synthetic Division"   HP-65 Math Pac 1.   September 1974.   pp. 34-35, 99




Next blog post:  November 25, 2023


Eddie


All original content copyright, © 2011-2023.  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, November 11, 2023

HP 42S/DM42 Programs in the Style of HP 65/67 Cards

HP 42S/DM42 Programs in the Style of HP 65/67 Cards


Programming Cards


In the 1970s, a programmable scientific calculators stored programs on magnetic cards.   The magnetic cards were then loaded on to calculator.   Two such calculators that used magnetic cards are the legendary HP 65 and HP 67, both from Hewlett Packard.    


The aim of these programs is to simulate classic programs from the HP 65 and HP 67 as they are stored on the cards, with prompts and messages to enhance the user experience.

The HP 65 had five user-definable keys A-E, while the HP 67 adds five additional user-defined labels a-e through a shift-key combination.

The MENU command on the HP 42S* creates a user key menu within a program, up to six keys.   I use this command to simulate running programs from loading cards.

(*and Free42, Plus42, Swiss Micros DM42)

The file included in the link below include four programs that are ported from various application books (pacs) of the HP 65 and HP 67.   


Demonstration Program:  demo.raw


When the program is run, a card is "simulated".   


I usually have the card in this format:

Left keys:  inputs, will sometimes give outputs

Key 4 (or 5): labeled CALC, get outputs

Key 6:  EXIT.  Exits the program.  Simulates removing the card.  


Demonstration


Key 1:  enter X coordinate

Key 2:  enter Y coordinate

Key 4:  calculate the norm

Key 6:  exit the program



Notes:  before GTO 30,  I have a pause command (PSE) so the menu returns.  

If I have multiple outputs, I have a stop command (STOP).  


Message convention: 

Prompts with a colon:  (:)  input

Prompts with an equals sign:  (=)  output


#  comments


00 { 134-Byte Prgm }

01▸LBL "DEMO"

02 "VECT NORM/ANG"         #  short description of the program

03 AVIEW

04 PSE                                        #  pauses the screen (allows for print)

05 "BY EWS"

06 AVIEW

07 PSE

08▸LBL 30                           # label 30 starts the menu

09 "→X"

10 KEY 1 XEQ 21

11 "→Y"

12 KEY 2 XEQ 22

13 "CALC"

14 KEY 4 XEQ 24

15 "EXIT"

16 KEY 6 XEQ 26

17 MENU                       # menu setup

18▸LBL 00

19 STOP

20 GTO 00                     # repeats the menu unless a menu key is pressed

21▸LBL 21                   # enter X

22 STO 01

23 "X:"

24 ARCL ST X   

25 AVIEW

26 PSE

27 GTO 30

28▸LBL 22                # enter Y

29 STO 02

30 "Y:"

31 ARCL ST X

32 AVIEW

33 PSE

34 GTO 30

35▸LBL 24            # calculate

36 RCL 02

37 RCL 01

38 →POL

39 "NORM="

40 ARCL ST X

41 AVIEW

42 STOP

43 "ANGLE="

44 ARCL ST Y

45 AVIEW

46 PSE

47 GTO 30

48▸LBL 26       # exit routine

49 CLMENU

50 EXITALL

51 .END.


Sample Output:


VECT NORM/ANG

BY EWS

X:5.7500

Y:6.8500

NORM=8.9434

ANGLE=49.9894


Program Space vs. Information Labels


When messages and alpha strings are added, along with the necessary AVIEW, PSE, and STOP commands, the program space requirements increase.   I put these messages to make the program as user friendly as possible.  



What's Included in the Zip Drive


Five programs:


Demonstration Program:  demo.raw

Sight Reduction Table:  str.raw

Physiologic Shunt and Fick:  phsy.raw

1-D Normal Shocks for Ideal Gases:  shock.raw

P and S Seismic Wave Velocity:  seismic.raw


PDF file of instructions and program listing



Download here (zip file):  

https://drive.google.com/file/d/1_0F_DHCGxcLbmCtrhMQbKShjrpBUgB7i/view?usp=share_link


Enjoy and please let me know, I plan to create another volume of these style of programs.  



Note:  The next blog entry will be on November 18, 2023


Eddie 


All original content copyright, © 2011-2023.  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. 


Sunday, November 5, 2023

Retro Review: Sharp PC-1248

Retro Review:  Sharp PC-1248





Quick Facts


Model:  PC-1248

Company:  Sharp

Years:  circa 1986, years of production unknown

Type:  Scientific, Pocket Computer

Power:  2 x CR-2032 batteries

Display:  1 line, 16 characters

Programming Language:  BASIC

Memory:  7,422 bytes


Program and Run


The Sharp PC-1248 is a credit card sized BASIC pocket computer, which is stored in a slip on hard case.  The screen is one line, containing up to 16 characters.  


There is one program space, allowing for line numbers from 1 to 999.   The range of commands are adequate for general mathematical applications.  


There are several peripherals available for PC-1248, including a printer and a cassette tape recorder to save and load programs.


Sharp also produced the PC-1246S pocket computer around the same time, only with memory capacity of 1,278 bytes.  


PC-1248 vs EL-5500 III




The PC-1248 operates similarly to the Sharp EL-5500 III pocket calculator; though it lacks the statistics mode and matrix operations.    I reviewed the EL-5500 III in 2017:  https://edspi31415.blogspot.com/2017/01/retro-review-sharp-scientific-computer.html



Keyboard:  It Could Have Been Better


To be honest, the keys are pretty hard to press.   I used a q-tip to press the keys at first when a soft-like stylus did not work.  However, the keys does have button under the keyboard.  This is the biggest complaint I have with the PC-1248.



Final Thoughts


I like the form factor of the PC-1248, and the command set is good for quick calculations on the run.   The computer is to the point, basic programming.   As I mentioned, the keys could have been better.   



Sample Programs for the PC-1248


Math Statement Builder: RUN 40


40 PAUSE "MATH STMT BUILD"

42 A = RND 21-1

44 B = RND 21-1

46 C = RND 21-1

48 D = A*B+C

50 PRINT A; "*"; B; "+''; C; "="; D:  END


Examples:  (results will vary)


4. * 3. + 7. = 19.


13. * 16. + 2. = 210.


2. * 8. + 3. = 19.


Net Present Value: RUN 60


60 PAUSE "NET PRESENT VALUE": CLEAR

62 INPUT "CF0:"; N, "RATE:"; I

64 J=1

66 INPUT "FLOW:"; F, "FREQ:"; K

68 FOR L=1 TO K: N=N+F/(1+I/100)^J: J=J+1

70 NEXT L

72 INPUT "MORE=1"; L

74 IF L=1 THEN 66

76 PRINT USING "########.##"; "NPV:"; N

78 END


Examples:


CF0:  -5000

CF1:   3000, frequency 1

CF2:  6000, frequency 1

Rate: 3%


Result:  NPV = 3568.20


CF0: -5000

CF1: 500, frequency 12

CF2:  0, frequency 6

CF3:  1000, frequency 6

Rate:  2.95%


Result:  NPV = 3207.18 



Future Value:  Continuing Compound Interest:  RUN 110


110 PAUSE "FV - CONT. CMPD. INT.": CLEAR

112 INPUT "PV? "; P

114 INPUT "RATE? "; R:  R=R/100

116 INPUT "YEARS? "; T

118 F=P*EXP(R*T)

120 PRINT USING "########.##"; "FV = "; F

122 END


Examples:


P = 5000, R = 5, T = 5.   Result:  F = 6420.12


P = 1000, R = 6, T = 20.  Result:  F = 3320.11


Source


"The Sharp PC-1246 computer":  http://pocket.free.fr/html/sharp/pc-1246s_e.html

"The Sharp PC-1248 computer": http://pocket.free.fr/html/sharp/pc-1248_e.html

The pocket computer museum.   1999-2022.  

Retrieved October 12, 2023.  


Eddie


All original content copyright, © 2011-2023.  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. 


Swiss Micros DM32 and Casio fx-4000P: Prime Factorization

Swiss Micros DM32 and Casio fx-4000P:   Prime Factorization Introduction  On March 22, 2017, I posted a prime factorization program for the ...