Hacker News new | ask | show | jobs
by c3d 592 days ago
Let's see your Python answers to the following examples:

1. What happens if I rotate binary pattern 1001 right by 3 positions on a 18-bit PDP-9?

  RPL code: 18 STWS 2#1001 3 RRC

  Result: #8001 in base 16, #1000 0000 0000 0001 in base 2.
What about if I do this on 6 36-bit words?

  RPL code: 6 36 * STWS 2#1001 3 RRC

  Result: #20 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001
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?

  Program: 20241107.000751_date 20241101.231527_date - 1_h convert UVAL →HMS
  Result: 120:52:24
(the "1_h convert UVAL →HMS" should really just be →HMS, but at the moment, →HMS is not smart enough to convert from days)