1. 20
  1.  

    1. 9

      Would be interested to see a comparison of this, Frink and Rink. If one doesn’t exist I’ll try them all and write it up somewhere.

      1. 5

        FWIW, I’ve tried to calculate 30 mpg to L/100km in both numbat and Rink, and neither can do it immediately.

        They both suggest inversion (numbat suggests inverting the right side, which is “wrong” if the unit on the right side is what you want), and then rink produces the correct value, while numbat ignores the 100 part:

        Rink:

        30 mpg to L/100km
        Conformance error: approx. 12754311.2 / meter^2 (fuel_efficiency) != 10000 micrometer^2 (area)
        Reciprocal conversion, invert one side
        
        (1 / 30 mpg) to L/100km
        7.840486[1]... liter / 100 kilometer (area)
        

        numbat:

        >>> 30 mpg to L/100km
        error: while type checking
          ┌─ <input:2>:1:1
          │
        1 │ 30 mpg to L/100km
          │ ^^^^^^ -- ^^^^^^^ Area
          │ │      │
          │ │      incompatible dimensions in unit conversion
          │ Length⁻²
          │
          =  left hand side: Length⁻²
            right hand side: Length²     [= Area]
            Suggested fix: invert the expression on the right hand side
        
        >>> (1 / 30mpg) to L/100km
          1 / 30 mpg ➞ litre / 100 kilometre
              = 0.0784049 l/km    [Area]
        

        P.S. I didn’t find how to specify UK gallons instead of US gallons in neither.

        1. 2

          FWIW, I’ve tried to calculate 30 mpg to L/100km in both numbat and Rink, and neither can do it immediately.

          Wolfram Alpha does even worse:

          https://www.wolframalpha.com/input?i=30+mpg+to+L%2F100km

          0.1275 L^(-1) (reciprocal liters)

          1. 1

            while numbat ignores the 100 part

            Oh, I hope they change that. The Rink unit conversion is pretty well specified, where x -> y computes x / y and then displays the result with y (unmodified) as the units. I think it’s surprising and less useful that numbat ignores the constants in y, but I could be missing something.

              1. 2

                Nice, thanks for the link! I think numbat will fully replace rink for me.

          2. 2

            We have a comparison with other tools in our documentation (https://numbat.dev/doc/comparison.html), but it does not include “Rink” at the moment.

            1. 1

              I would love to see that - I’ve used Rink regularly for years and my first question was how numbat differs from Rink.

            2. 4

              This tool has become very handy to me! From binary to hex conversion to km to Miles or voltage and watts to amps, it is very very handy!

              It’s worth spending a few minutes in the documentation, it is very very useful!

              1. 2

                honestly numbat looks really nice but it, like every other calculator program i’ve seen, seems to be completely missing RPN support, so i’ll stick to my old HP calculator for now lol

                (if anyone knows a modern calculator/math lang that actually does RPN correctly pls lmk)

                EDIT: a single line on Qalculate!’s features page mentions it

                1. 2

                  This looks like it could partially replace speedcrunch in the long run. especially for doing all my electronics computations, where stuff like figuring out the switching parameters of a buck converter is quite some math to do right, and not messing up the units

                  the docs are quite good, the unit support seems great and having your own modules and functions makes it a good tool as well

                  1. 1

                    I’d be interested to know if there are any features that you are lacking from speedcrunch?

                    1. 1

                      not much!

                      1. being able to make scripts for non-ad-hoc computations
                      2. tighter binding of units. 1 meter / 2 seconds will yield ((1 meter) / 2) seconds which is just unintuitive

                      1. is the reason to check out numbat more closely, because i can store a set of formulas for later reuse, or as documentation on how i got my results
                      1. 1

                        Oh, wait. That sounds like you are listing things that you are missing in speedcrunch. You said Numbat “could partially replace speedcrunch in the long run”, so I was mostly interested why you said “partially”? Are there any features in Numbat that you are missing (from speedcrunch)?

                        (if I am misunderstanding your post: we do support scripts for non-ad-hoc computations in Numbat, and 1 meter / 2 second is parsed as (1 meter) / (2 second) in Numbat: https://numbat.dev/doc/operations.html?highlight=implicit#operations-and-precedence)

                        1. 1

                          Yeah, i compared what numbat can do what speedcrunch cant :)

                          what numbat can’t do (i think) is the excellent GUI with numeric binary view.

                          one of my primary use cases with speedcrunch is hex<>int conversion together with the bit viewer/editor, as well as all the integer artihmetic used with bit fiddling

                          the table you’ve listed doesn’t contain any bitwise operators, right?

                          things i use in speedcrunch more than everything else:

                          • mask/unmask: convert from/to two’s complement
                          • bit shifts, bitwise and, bitwise or, bitwise inversion
                          • ieee_decode, ieee_encode
                          • fractional hexadecimal/binary numbers
                  2. 1

                    I have always wondered how these applications work with exchange rates; are they updated in the source code with each release?

                    1. 4

                      Don’t they fetch the current rates from some external source?

                      1. 1

                        Interesting that they have both physical dimensions and units. Other languages with units, like F# only have units.

                        Because they also have physical dimensions as types I would expect the operations supported for these types would respect the algebraic structure of the dimensions, but it appears this is not the case. For example energy and voltage are torsors and not groups.

                        1. 2

                          I explained the type system in a bit more detail here (https://numbat.dev/articles/intro.html), here (https://numbat.dev/doc/function-definitions.html#type-inference) and here (https://numbat.dev/doc/type-system.html). I’d be interested to understand what you think we are missing or modelling incorrectly.

                          Side remark: Numbat’s type system is very much inspired by the PhD thesis of Andrew Kennedy, who wrote F#’s unit of measurement system. Unlike his implementation in F#, the PhD thesis is actually also based on physical dimensions, and in my opinion, it is the better approach in general. For example, it allows you to type something as a ‘Length’, but you still leave the freedom to have the runtime value be in centimeters or inches — without sacrificing correctness.

                          1. 1

                            What makes energy and voltage torsors and not groups?

                              1. 1

                                Interesting, thanks.

                                Isn’t this a more general issue? It’s often the case that we make measurements with implicit reference to some arbitrary origin, eg, position / distance, time / interval.

                                Can it be fixed by saying that the types represent change of energy and change of voltage?