A physicist working on the project used this to compute the space contraction for the https://en.wikipedia.org/wiki/Oh-My-God_particle, which presumably traveled at 0.9999999999999999999999951 time the speed of light. You cannot do that with your HP48GX directly using standard formulas, because it only has 12 digits of precision.
2. What is the symbolic expression of the determinant of some 2x2 matrix?
Program: [[1 y]['2+x' b]] DET
Answer: 'b-(x+2)·y' (shows graphically on calculator screen)
3. What is the output voltage of a voltage divider with input voltage 100V, R1=4kΩ, R2=10Ω
Program: R1=4_kΩ R2=10_Ω V=100_V 'ROOT(ⒺVolt Divider;[V1];[1_V])' EVAL
Result: [ V1=99.75 V ]
Note that ⒺVolt Divider is a built-in equation, but you can of course put your own.
4. Verify if Ramanujan constant exp(sqrt(163)*pi) is an integer.
Program: « 'exp(√ 163·Ⓒπ)'60 PRECISION →Num FractionalPart »
Result: -7.50E⁻¹³, so no, not an integer, but really close
5. Verify Maxwell's value for the speed of light, epsilon0 * mu0 * c^2 = 1.
Program: '(√(Ⓒε0·Ⓒμ0))⁻¹' →Num
Result: 299 792 458.00 m/(F↑(¹/₂)·H↑(¹/₂))
Convert to SI units: UBASE
Result: 299 792 458. m/s
Convert to feet per second: ³⁷⁴ ⁷⁴⁰ ⁵⁷² ⁵⁰⁰/₃₈₁ ft/s or 983 571 056.43 ft/s.
(if you subtract the Ⓒc constant, you get -0.00031 11057 21 m/s)
6. Check the Collatz conjecture on 989345275647
Program: « if dup 1 ≠ then if dup 2 mod then 3 × 1 + else 2 ÷ end Collatz end » 'Collatz' STO 989345275647 Collatz
Result: 1 (conjecture is verified)
7. Given that it's now Nov 7, 00:07:51 and that a program I started on Nov 1st at 23:15:27 just finished, how long did it run?
Let me illustrate using an example from a YouTube video called "The hardest Exam Question : Only 6% of students solved it correctly" (https://www.youtube.com/watch?v=NfgEPsm9Jzw), which is about a simplified formulation for (sqrt(2)-1)^10.
The first remark is that a CAS-capable calculator like DB48x can help with the symbolic part of the computation shown in the video. However, to be fair, DB48x still lacks some of the relevant HP48 interactive equation manipulation features to be able to demonstrate that. So let's focus for now on the numerical part.
The author shows that (sqrt(2)-1)^10 is the same as 3363-2378*sqrt(2). Let's evaluate that using bc.
Attempt 1: bc, then (sqrt(2)-1)^10-(3363-2378*sqrt(2))
Result: -985. Er... What?
OK. What is the option for precision again? man bc. Search for precision. Mentions the @ operator. Does not seem to do it. 5 minutes of search later, find that precision is called scale, that I need the -S option. I could also presumably use the -l option, which experimentally seems to set the scale to 20. Starting to remember why I am not a big fan of bc ;-)
Trying again. bc -l
(sqrt(2)-1)^10-(3363-2378*sqrt(2)) now gives me:
-.00000000000000000402.
Counting "bc -l" and ENTER keys, that's I believe 42 keystrokes.
Trying again with db48x: I need 23 keys using the most naive RPN data entry. The result is -1.57861 99E⁻²⁰ with the default 24-digit precision.
I can also enter the same algebraic expression as in bc directly in the simulator using copy-paste. I get a nice graphical rendering of the expression, which I can check, and then just one key (EVAL/=) to get the numerical value.
As another example, let's try to check if the Ramanujan constant in an integer:
bc -l
e(sqrt(163)*pi(20))
262537412640768743.98947654935272888605
That does not look like an integer to me. And it's way more than the 20 digits I would expect from scale. What is weird is that it gives me a false sense of accuracy, all the digits after "43.9" are bogus, as shown by switching the scaling to 100:
21 keystrokes, and a result that is a bit hard to interpret with the default precision (scaling). In other words, it's pretty easy to get bogus numerical results and not know it.
With DB48x, after selecting a precision of 100, 11 keystrokes including menu selection to get the pi constant, and I get:
262 537 412 640 768 743.99999 99999 99250 07259 71981 85688 87935 38563 37336 99086 27075 37410 37821 06479 10118 60730 76
> At least I can easily copy the results and the code to a document which avoids transcription errors.
This is also true with the DB48x simulator, which supports copy and paste both ways. This is how I copied the values above, or entered the exact same algebraic expression as in bc into the simulator.
> I admire the project, although I would probably have taken a different path (emulation) to get the biggest effect with the smallest possible effort :-)
Emulators are stuck in the past, since they need to rely on the HP ROMs. So all the nice new features in DB48x, like variable-precision decimal arithmetic, support for higher-resolution graphics and colour, tail-recursion optimization, object size optimizations, polar and rectangular complex numbers or vectors, or the extensive Markdown-based builtin help would all be impossible to implement.
> I wish there was a good HP50G emulator for iOS — there used to be one, but it was abandoned (contact me if you want to develop it and would like to get the source code, it was under the GPL and I got it from the author).
I have two pretty good emulators on my iPhone, one is iHP48, the other is i48. Both can emulate the HP50G if you load the correct ROM, IIRC.
That being said, I second the idea that if you got the source in GPL form, you should publish them on GitHub. Or share with me and I will do it, possibly restore it (I have vague plans to restore Emu71 as well, when I'm done with DB48x).
> Where's the apostrophe (equiv. to quote in lisp)? That should be an easily accessible key not buried in a menu.
The apostrophe is on the XEQ key of the DM42, or "F". But in RPL, it is not to quote like in Lisp, but to introduce algebraic expressions (although it does quote names as a side effect).
The key is labeled like this because it serves a dual purpose to accommodate the smaller number of keys on the DM42 relative to the HP48. It adds a tick when not inside an expression, which in RPL begins an algebraic expression. When you are inside an algebraic expression, then you don't need tick anymore, so the key inserts parentheses inside.
> - Why did he swap the log keys?
Because I personally prefer to have exp and ln rather than ln and log. I also would prefer to have y^x as a primary, unshifted key, and this change is coming soon.
But I recognize that keyboard layout is a personal preference, so I'm currently working on making this customizable. Recently, "User mode" has been introduced, which lets you reconfigure the keyboard the way you want. So if you want to restore decimal LOG as the primary key instead of EXP, then do this: 'LOG10' 24.1 ASN. You should be able to restore EXP to the original position with 'EXP' 25.2 ASN, but there is bug with shifted user keys that I need to fix. This should be fixed in the next release.
In addition, the very next release should offer three layouts:
1) One that is maximally compatible with DM42 / HP42, which I assume is what you want.
2) One that corresponds to the current layout, so that people with existing overlays can keep them.
3) One that corresponds to a new iteration of the key layout that is better suited for DB48x, which is currently being discussed on the HP Museum forum.
There is no backtracking, but being able to implement Prolog on an XL basis was an important part of the original design of the "runtime" version of XL.
./xl -nobuiltins -parse /tmp/glop.xl -style debug -show
(infix is
is
is
)
So what it sees is a definition of a name 'is' as itself.
Now, that name is very unlikely to be usable because `is` as an infix is so central to everything. As a matter of fact, it looks like even "is is 2" actually crashes the current implementation.
Oh well. I wonder what a sensible error message on this would be. Probably: "Bill Clinton denied to comment on the meaning of that statement".
> "Bill Clinton denied to comment on the meaning of that statement".
Oh man, that’d be hilarious.
I’ve been hacking around with my own sorta Forth/Postscript like attempt at a language that runs on WebAssembly and does graphics in the browser.
Odds are it’ll never see the light of day. But if it does, you’ve now triggered all kinds of ideas for ridiculous ideas for error messages. Like starting them of with ‘hey bruh…’ or trotting out good ol’ Mr Clippy from Microsoft.
How it works is what I tried to document in the document above. The trick is to have some fixed semantics on how rewrites are done, but a lot of freedom in how this is implemented. And this is far from perfect ATM.
For example, if you write "X is 2", this can be implemented as a constant, as a function returning a constant, or as a macro. However, if you write "X is seconds" in Tao3D, where "seconds" returns the current number of seconds in the clock, then it can no longer be a constant value. You still can use macro replacement (or inlining) or turn it into a function.