Live data from Hacker News

Show HN: Insect – a high-precision scientific calculator with physical units

insect.sh

21–30 of 205 posts

Re: Show HN: Insect – a high-precision scientific calculator with physical units

#23
post #7

I like this, but would really like a convert-to-base-units function. ≫ sqrt(1/(eps0 mu0)) ->m/s sqrt(1 / (eps0 × mu0)) -> m / s = 299833000 m/s ≫ sqrt(mu0/eps0) ->ohm sqrt(mu0 / eps0) -> Ω = 377.031 Ω

Fun fact: Converting to a unit is exactly the same as dividing by it (temperatures are the exception), so this works too:

    ≫ sqrt(mu0/eps0) / ohm
      sqrt(mu0 / eps0) / Ω
       = 376.73
Also seems like the constants (!) got changed a bit since you executed this

Re: Show HN: Insect – a high-precision scientific calculator with physical units

#25

Looks really nice! ≫ exp(2*kg/s) exp(2 × (kg / s)) Conversion error: Cannot convert quantity of unit kg/s to a scalar Excellent! Is there any way I can save a list of variables to file and then reload them? I also would like to vote for supporting imaginary numbers (Issue #47).

Thank you for the feedback!

> Is there any way I can save a list of variables to file and then reload hem?

Not yet, no - thank you for the suggestion. The command-line version can read from a file, though (https://github.com/sharkdp/insect/issues/40)

Re: Show HN: Insect – a high-precision scientific calculator with physical units

#28

Hmm, I find the auto-associativity to be a bit weird for example: ≫ 1/12 c 1 / (12 × c) = 2.7797e-10 s/m

Thank you very much for the feedback!

This is on purpose (see operator precedence rules: https://github.com/sharkdp/insect#reference). Implicit multiplication (without an explicit multiplication operator) has a higher precedence than division in order for something like this to work:

  tan(15cm/3m)

  = tan(15cm/(3m))
On the other hand, explicit multiplication has a lower precedence than division, so you would have to write "1/12*c". I agree that it can be confusing at times (that's why there is a pretty printer), but I don't want the language/parser to be whitespace-aware.

Re: Show HN: Insect – a high-precision scientific calculator with physical units

#29
post #3

This is pretty cool, it's one of the rare applications I've used where the things I've tried "just work". For example "10 kg to g", "c", "c to km s^(-1)", "c to km/s" all work intuitively. It's great it works at the command line too. Something I wish I'd had when I was studying Physics.

All of these things work in Google, btw. Google has one of the best unit conversion tools, and it's built into the search.

I've always been frustrated by how Google's unit conversion doesn't integrate well with its calculator.

Re: Show HN: Insect – a high-precision scientific calculator with physical units

#30

It unfortunately fails my go-to test for these calculators: ≫ 7.8L/100km -> miles/gallon 7.8 L / 100 km -> mi / gal Conversion error: Cannot convert unit L/km (base units: m²) to unit mi/gal (base units: m⁻²)

That's because your unit conversion is invalid. It's entirely possible to construct an equation that computes mi/gal from L/km (or from gal/mi for that matter), but the dimmensionalty of the two numbers clearly disagree. Yes, you can introduce scenarios like yours where "any human" would know what the intended meaning of the question is, but mathematically speaking it's incorrect and encouraging a calculator to perform mathematically incorrect operations is a recipie for both disaster and the introduction of student/user misunderstandings.
Post reply on HN