Casio fx-3800P "Programming"
|
03-06-2020, 02:42 PM
Post: #1
|
|||
|
|||
Casio fx-3800P "Programming"
I use the word "programming" a bit loosely, because this model does little more than record a sequence of keystrokes, with a placeholder (ENT) to pause and get user input. It has somewhere around 150 program steps that can be split up across 4 programs, but programs can't call each other. This is literally the full extent of the flow control and decision making:
- Pause and display a result (HLT) - Pause the program and accept an input (ENT) - Restart the program (RTN) - Restart the program if x>0 - Restart the program if x<=M No labels, no goto. Despite this, the manual has a few clever sample programs, like this one that simulates indirect addressing to accumulate frequency sums for a five-bucket histogram: Code: Prog I Initialize the program by pressing Shift KAC, then I. Input the bucket number (1-5) and press RUN, then input the value/frequency and press RUN. Keep entering bucket number and frequency pairs, and press II to view the totals (press RUN to view the next total). Arguably, one could simply use K in + n to accumulate the values, but the program saves one keystroke per data pair, and you don't risk destroying a total if you miss the + key. You wouldn't think it would be possible to write a prime factor finder on a calculator with no Int or Frac functions, and no flow control besides "once more from the top", but fortunately I have more determination than sense, so here it is. The program needs all 7 storage registers and uses Fix 0 mode and the Rnd function to round division results, which is just enough to test divisibility. It can factor 9,999,999,999 in about a minute. There is definitely no mod 30 sieve here. Code: Prog I To use the program, enter the number to factor and press I. Then press II to start factoring. The program will stop when it finds a factor. Press RUN to find the next factor. The program will deliberately cause an error to end early once the divisor has exceeded the square root of the remaining numerator (it does this by attempting to take the square root of the numerator's square root minus the divisor - just pretend the "E" stands for End). Press AC, K out 1 to see the final factor. The program can accurately factor any integer up to the full 10-digit precision of the calculator, if you're patient enough. (e.g. it doesn't think 2 is a factor of 9,999,999,999.) |
|||
03-07-2020, 01:19 AM
Post: #2
|
|||
|
|||
RE: Casio fx-3800P "Programming"
That's brilliant, Dave.
And the first proper program that I've keyed into my new 3800P But I've just opened a 5800P, so I need to play with that now; somewhat of a contrast! thanks. Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
03-07-2020, 02:34 AM
Post: #3
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-07-2020 01:19 AM)cdmackay Wrote: That's brilliant, Dave. Ha ha, yeah, rather stark difference between those two. Not sure what the upper limit is on program complexity for the 3800, but it looks like it's possible to compute incomplete gamma by integration: http://www.rskey.org/fx3600p And it can probably handle the usual stuff like cumulative binomial and negative binomial probability. |
|||
03-07-2020, 12:18 PM
Post: #4
|
|||
|
|||
RE: Casio fx-3800P "Programming"
I recently acquired a Tandy EC-4019, which appears to be one of those Casio OEM machines. In this instance it's a rebranded Casio fx-3800P. I'll have to try this on it.
There are only 10 types of people in this world. Those who understand binary and those who don't. |
|||
03-07-2020, 12:22 PM
Post: #5
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-07-2020 12:18 PM)grsbanks Wrote: I recently acquired a Tandy EC-4019, which appears to be one of those Casio OEM machines. In this instance it's a rebranded Casio fx-3800P. I'll have to try this on it. Yup! Mine is actually a "Radio Shack EC-4019". I didn't realize they also sold rebranded calculators with the Tandy name on them. I guess that gives me more search ammo for ebay. |
|||
03-07-2020, 12:32 PM
Post: #6
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-07-2020 12:22 PM)Dave Britten Wrote: Yup! Mine is actually a "Radio Shack EC-4019". I didn't realize they also sold rebranded calculators with the Tandy name on them. I guess that gives me more search ammo for ebay. Tandy Corporation stuff was always marketed under the "Radio Shack" brand in the US for some reason. Over here in the UK, they kept the name Tandy for this kind of product. HiFi equipment was sold under the "Realistic" brand, I think. There are only 10 types of people in this world. Those who understand binary and those who don't. |
|||
03-08-2020, 03:47 AM
Post: #7
|
|||
|
|||
RE: Casio fx-3800P "Programming"
Amazing! I've had Casios since I were a lad… yet I've never seen one of those Tandy OEMs. Were they common? Where were they sold, do you know?
Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
03-08-2020, 11:12 AM
Post: #8
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-08-2020 03:47 AM)cdmackay Wrote: Amazing! I've had Casios since I were a lad… yet I've never seen one of those Tandy OEMs. Were they common? Where were they sold, do you know? It's hard to tell, for me anyway. I was living abroad at the time of Tandy/RS's heyday in this country (I was in France from 1983 to 2007) and this calculator was a chance find on TAS. There are only 10 types of people in this world. Those who understand binary and those who don't. |
|||
03-08-2020, 02:34 PM
Post: #9
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-07-2020 12:22 PM)Dave Britten Wrote:(03-07-2020 12:18 PM)grsbanks Wrote: I recently acquired a Tandy EC-4019, which appears to be one of those Casio OEM machines. In this instance it's a rebranded Casio fx-3800P. I'll have to try this on it. Mine is also a Radio Shack EC-4019. I was disappointed to learn that this model doesn't have the AND and OR Boolean functions. |
|||
03-08-2020, 02:52 PM
Post: #10
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-08-2020 02:34 PM)Eddie W. Shore Wrote: Mine is also a Radio Shack EC-4019. I was disappointed to learn that this model doesn't have the AND and OR Boolean functions. I think there are a lot of other lacking features I would address before worrying too much about those. Anyway, there are plenty of alternatives for those on Casio's symbolic programming models (fx-4000P/EC-4020, fx-7000G, etc.) which also don't allow them in conditional tests. And: Just string two conditions together. X>0=>X<Y=>Goto 4 Or: Either write the conditions+predicate multiple times, or if that's too wasteful (lots of conditions, multiple statements in the predicate, etc.), logically invert the conditions you're testing and jump over the conditionally executed code with a Goto. If you're talking about bitwise And/Or for Base-N mode, then those might be doable with what passes for programming on the 3800P. Not sure. |
|||
03-09-2020, 08:10 AM
Post: #11
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-08-2020 03:47 AM)cdmackay Wrote: Amazing! I've had Casios since I were a lad… yet I've never seen one of those Tandy OEMs. Were they common? Where were they sold, do you know? In the UK, they were sold only in Tandy stores. — Ian Abbott |
|||
03-09-2020, 10:50 AM
Post: #12
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-07-2020 02:34 AM)Dave Britten Wrote: Not sure what the upper limit is on program complexity for the 3800... Check Xerxes' posts here: https://www.hpmuseum.org/forum/thread-7772.html New dimensions in blind programming. Highly recommended the GCD routine and do not forget two times press the minus key before running! Is there someone who can explain how this program works with this constant feature?! Cs. |
|||
03-09-2020, 11:58 AM
Post: #13
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-09-2020 10:50 AM)Csaba Tizedes Wrote:(03-07-2020 02:34 AM)Dave Britten Wrote: Not sure what the upper limit is on program complexity for the 3800... That's pretty clever switching in and out of Base-n mode to extract the integer part. I'm used to Casios requiring you to define your program mode up front (Comp, Base-N, SD, LR, etc.), and it never occurred to me that you could switch on the fly with these keystroke-programmable models. |
|||
03-10-2020, 01:33 PM
Post: #14
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-07-2020 12:18 PM)grsbanks Wrote: I recently acquired a Tandy EC-4019, which appears to be one of those Casio OEM machines. In this instance it's a rebranded Casio fx-3800P. I'll have to try this on it. Xerxes adviced for me to use the fx-180P Plus. This is a fastest "blind programmable" and fortunately not blind programmable, because there is a possibility to edit and modify the code. The smallest counter (1 M+ RTN) program speed is exactly 100 counts/sec(!) which is really notable. Today evening (CET) I will go back with a little program for my 50F, which can be run on any similar unit. Csaba |
|||
03-10-2020, 11:02 PM
Post: #15
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-10-2020 01:33 PM)Csaba Tizedes Wrote: Today evening (CET) I will go back with a little program for my 50F, which can be run on any similar unit. Estimating real numbers with fractions ====================================== Let K is a (real) number and estimate it with the fraction A/B, where A and B are relative primes and ABS(A/B-K)<=E, where E is a small number. The algorithm is a simple brute-force-counting algorithm: Let A=0 and B=1. If ABS(A/B-K)<=E, the program stops. If A/B-K<0 then A=A+1, else B=B+1. The above in BASIC: ------------------- 10 D=A/B-K 20 IF E>=ABS(D) THEN PRINT A,B:END 30 IF D<0 THEN A=A+1:GOTO 10 40 B=B+1:GOTO10 On blind programmable CASIOs: ----------------------------- Code: P1: Variables: ---------- K1: A (numerator) K2: B (denominator) K3: H (=A/B) K4: K (the number) K5: E (eps = absolute error of estimation; can be calculated as percent of K for relative error) M: for decisions For type in: (let K=PI) ------------ 1 Kin1 Kin2 PI Kin4 ×0.001 = Kin5 For running: ------------ 0 Kin1 1 Kin2 P1 The results: ------------ Tested on CASIO fx-50F Code:
Short explanation: ------------------ In 05~12 steps the A is increased until H>K-E. If we are in K+/-E "good" range (tested in step 23) the program ends... ...or A is too high and H>K+E, in this case we must to increase the B. We can increase B in the following way: first decrease A in step 14 because in steps 05~12 the A will be increased during the next cycle and the original A will be present and increase B in step 15. Important: the H is not changed when A and B changed, because H is required in step 23, but when the program finished, must to correct A and B in step 24~26. nJoy! Csaba |
|||
03-11-2020, 12:06 AM
Post: #16
|
|||
|
|||
RE: Casio fx-3800P "Programming"
(03-06-2020 02:42 PM)Dave Britten Wrote: You wouldn't think it would be possible to write a prime factor finder on a calculator with no Int or Frac functions, and no flow control besides "once more from the top", Well done! I love it to check the limits of this type of keystroke programming. I use normally these steps for INT and FRAC: Code: Rounding: Calculator Benchmark |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: