Dismal Arithmetic & 3 Progs for 49G & Others
|
04-21-2015, 04:18 PM
(This post was last modified: 09-08-2022 06:14 AM by Gerald H.)
Post: #1
|
|||
|
|||
Dismal Arithmetic & 3 Progs for 49G & Others
Dismal arithmetic was invented to help less proficient arithmeticians to achieve easier results. There are two operations, addition & multiplication.
Addition is no-carry & the sum of two digits is the larger of the two. eg 123456789 + 987654321 = 987656789 Multiplication is no carry & the product of two digits is the lesser of the two. eg 12345678901 * 7 = 12345677701 The first few dismal squares are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 111, 112, 113, 114, 115, 116, 117, 118, 119, 200, 211.... For more see: http://oeis.org/A087019 For more info & better explanations than I can give, try these three links: https://proofwiki.org/wiki/Definition:Dismal_Addition https://oeis.org/wiki/Dismal_arithmetic http://arxiv.org/pdf/1107.1130.pdf Two programmes for the HP 49G; DPLUS accomplishes dismal addition of two positive integers & DMULT the dismal multiplication of two positive integers. DPLUS Code: :: DMULT Code: :: I eagerly await the appearance of some dismal arithmetic programmes on the Prime. |
|||
04-21-2015, 09:19 PM
Post: #2
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
(04-21-2015 04:18 PM)Gerald H Wrote: I eagerly await the appearance of some dismal arithmetic programmes on the Prime. Here is my version of DPLUS and DMULT for the Prime: Code: EXPORT DPLUS(a,b) |
|||
04-22-2015, 01:09 AM
Post: #3
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
Rather interesting concept. Does this have any practical applications?
|
|||
04-22-2015, 01:18 AM
Post: #4
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
(04-22-2015 01:09 AM)Dave Britten Wrote: Rather interesting concept. Does this have any practical applications? I'm not sure about base-10 dismal arithmetic, but the base-2 equivalent is quite commonly used. The base-2 dismal addition and multiplication operators are the logical OR and AND operators, respectively. |
|||
04-22-2015, 06:55 AM
Post: #5
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
(04-22-2015 01:18 AM)brouhaha Wrote: I'm not sure about base-10 dismal arithmetic, but the base-2 equivalent is quite commonly used. The base-2 dismal addition and multiplication operators are the logical OR and AND operators, respectively.With different results of course. |
|||
04-22-2015, 07:04 AM
Post: #6
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
(04-21-2015 09:19 PM)Didier Lachieze Wrote:(04-21-2015 04:18 PM)Gerald H Wrote: I eagerly await the appearance of some dismal arithmetic programmes on the Prime. The programmes are nicely short & may work - I started to type them into the Prime & gave up due to the obscurity of the keyboard. I guess I'll have to wait until I'm issued with new eyes as I expect that'll happen before a better keyboard is produced. |
|||
04-22-2015, 07:16 AM
Post: #7
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
(04-22-2015 07:04 AM)Gerald H Wrote: The programmes are nicely short & may work - I started to type them into the Prime & gave up due to the obscurity of the keyboard. I agree with the keyboard contrast issue and I have improved it with some stickers on my Prime. Anyway you don't have to type each single character on the Prime keyboard, all functions are available in menus or catalogs. Then you have to memorize a few characters, mainly ":", "=" and ";". Or you can simply use the connectivity kit, and copy paste the programs for use in the Emulator or your real Prime. |
|||
04-22-2015, 07:45 AM
Post: #8
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
Here is a slightly improved version of DPLUS using this trick for string padding:
Code: EXPORT DPLUS(a,b) |
|||
04-22-2015, 08:54 AM
Post: #9
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
Dear Didier,
Thank you for your efforts to help me. I have two problems in implementing your suggestion, one is a question of principle, the second practical. 1 A calculator should be a portable independent unit. All of the programmes I have written for 48G, 42S, 49G & 50g have been written on the calculator, occasionally in the middle of nowhere, ie no mains electricity. Having to download from an object the size of a lap-top or PC is simply not practicable. 2 I have downloaded your progs & stored them in pure text files on my home computer but they aren't accepted by the calculator. Again, thanks for the assistance. |
|||
04-22-2015, 09:56 AM
Post: #10
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
(04-22-2015 08:54 AM)Gerald H Wrote: I have two problems in implementing your suggestion, one is a question of principle, the second practical. I agree, and I can tell you that yesterday evening I’ve written these programs directly on my Prime. The only point is that with calculators as complex as the 48/50 or Prime you need some practice to be used to the keyboard and where to find the different functions. It can be easier to write programs on a computer when possible. Of course in case of the Prime the keyboard contrast makes it a bit more difficult for aging eyes … (and mine are also on the aging side now). (04-22-2015 08:54 AM)Gerald H Wrote: 2 I have downloaded your progs & stored them in pure text files on my home computer but they aren't accepted by the calculator. Well, I just copy/paste from the forum to the connectivity kit after creating a new program on the Prime from the connectivity kit (right click on “Programs” and select “New”) and it works fine. Anyway I’ve attached the .hpprgm file that you should be able to directly drag and drop in the connectivity kit, then you just need to open it on your Prime and Check it before using it. Dismal.zip (Size: 417 bytes / Downloads: 5) |
|||
04-22-2015, 10:07 AM
Post: #11
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G
Downloaded, unzipped & tested - results correct so far.
Thank you. |
|||
05-06-2015, 05:34 PM
Post: #12
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G & the Prime
Here's a straight-forward UserRPL version I threw together on my 48SX. It's only intended to operate on non-negative integers; passing anything else has undefined results.
Code: NUMLEN: Usage is pretty straight-forward. Enter your two operands on the stack, and run DADD or DMULT. I might take a stab at doing a 32S version. |
|||
05-07-2015, 01:48 PM
Post: #13
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes for the HP 49G & the Prime & the HP 48S
And here's a 32S version for the terminally bored. It probably works on a 32Sii or 33S/35S, though the sizes, checksums, and speed may differ.
Multiplying 435,821 by 2,949,229 takes about 23 seconds my 32S (rotten nested loops...) and yields 244,585,835,821. Code: Total bytes: 166.5 |
|||
05-07-2015, 03:25 PM
Post: #14
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes 49G, the Prime, 48S & 32S | |||
05-07-2015, 03:57 PM
(This post was last modified: 05-07-2015 04:59 PM by Gerald H.)
Post: #15
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes 49G, the Prime, 48S & 32S
My 32S II using Dave's programmes unaltered takes 28 sec for 435,821 dmult 2,949,229. Answer again correct.
|
|||
05-07-2015, 04:59 PM
(This post was last modified: 05-07-2015 05:00 PM by Gerald H.)
Post: #16
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes 49G, the Prime, 48S & 32S
My 35S using Dave's programmes unaltered takes 56 sec for 435,821 dmult 2,949,229. Answer again correct.
|
|||
05-07-2015, 05:36 PM
Post: #17
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes 49G, the Prime, 48S & 32S
Yeah, that perpetual slowdown of the family is one of the main reasons I stick with the original 32S. The other reasons being that my 32Sii has a janky keyboard, and the 35S is full of bugs.
|
|||
05-07-2015, 06:01 PM
Post: #18
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes 49G, the Prime, 48S & 32S
My 32S, SNr 3246S.... keyboard in order - which I can't say of the 35S, SNr CNA 021..... where some of the keys are erratically unresponsive.
|
|||
05-08-2015, 01:35 AM
Post: #19
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes 49G, the Prime, 48S & 32S
For those of you who have already died of boredom, here's a TI-95 version. It's not terribly fast. Even with all the control transfer statements ASMed, it took 42 seconds to compute 435,821 * 2,949,229.
Run the program to get the main menu, then separate your two arguments with x~t and press F1 or F2 to add or multiply. (As if anybody here besides me has a TI-95 and cares enough to try this.) Code: 280 Bytes Some notes: If you ASM and then subsequently INV ASM the program, the GTL M1 instruction doesn't get converted back from the step number. No idea why. The comparison tests are very flexible, yet limited at the same time. You can compare the display register (x) with any storage register and skip the next instruction if false, but there's no way to compare x with 0 without storing 0 somewhere, and you can't directly test x against t unless you unprotect the system and access it via system register number 2079. The lack of ISG is surprisingly annoying. I may attempt doing this on the TI-66 if I hit my head and forget how awful the comparison tests are on that. (You only get x=t, x!=t, x>=t, and x<t, and you're only able to have an implied GTO after it, so doing a conditional RTN requires a label followed by a RTN floating around in your program somewhere.) |
|||
05-08-2015, 02:53 PM
Post: #20
|
|||
|
|||
RE: Dismal Arithmetic with Two Programmes 49G, the Prime, 48S & 32S
(At least) one more: Casio fx-8500G. 435,821 * 2,949,229 takes 16 seconds, but seems to overflow the precision of the machine. I get 244,585,835,800 instead of 244,585,835,821.
Code: Prog 3 - Number Length |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)