πŸ‘€paddim8πŸ•‘4yπŸ”Ό239πŸ—¨οΈ84

(Replying to PARENT post)

I immediately found a few Unicode features I hoped were supported but aren’t.

Superscripts: firstly numerals, like 3² = 9, but ideally then letters as well, e.g. 3ⁱ = 3^i. Might be suitable to support superscripts to define nth roots, too, e.g. ⁡√. tan¯¹ can be a thing too.

Subscripts: same deal; logβ‚‚ 31 = log(31, 2).

Proper arithmetic operators: times (Γ—), minus (βˆ’), division (Γ·). Also fraction slash (⁄), which can be preceded and succeeded either by normal numerals (e.g. 12⁄34) or by superscripts and subscripts (e.g. β΅βΆβ„β‚‡β‚ˆ). (Full font support for fraction slash is weak, but generally tolerable even if imperfect.) Also the prebaked fractions like Β½ and β…œ.

Also mixed fractions: I reckon 1 2/3 should be parsed as 1+2/3, not 12/3. Them Unicode fractions can join in here too, with 1β…” (using a prebaked fraction) being 1+2/3, or 1²³⁄₄₅ (using superscript, fraction slash, subscript) being 1+23/45.

Cubic and quartic roots: βˆ› and ∜.

At this point it’s worth just looking through the whole Symbol, Math Unicode category and implementing everything applicable. Hmm, set operations, lots of fun symbols there.

Lots of fun spaces too, e.g. where I wrote logβ‚‚ 31 earlier I wanted to use NARROW NO-BREAK SPACE after the β‚‚, but alas, HN normalises it to a plain old space. That space gets used as a number grouping separator especially, avoiding the whole ,/. localisation problem without being too wide.

πŸ‘€chrismorganπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

kalk is a calculator that has syntax highlighting, automatically turns names into symbols (eg. sqrt to √), supports math-like syntax (eg. f(x) = x(2sinx + 3) , estimation of derivatives and integrals, complex numbers, and runs in the browser using WebAssembly.
πŸ‘€paddim8πŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

This looks extremely useful, even though currently makes quite a few mistakes, as noted by others. A few features that could be nice:

1) It handles 1 000 000 * 3 just fine, but returns 3000000. So it would be nice if it would format output as 3 000 000 as well for readability. At least as an optional setting (even though I have no idea why someone wouldn't want that).

2) Some way of referencing last result. Often you need to perform operations step by step, when, say, estimating something. So either 10 \n + 20 \n * 3 ..., or just referencing last output like some special variable. I though I could do it more verbosely by just x = 10; x = x + 20 ..., but that gives "Variable references itself."

3) Not sure about this one, since this is not something natural at all, and I don't know what to propose to make it natural (at least without proposing map/filter/reduce and some sort of multi-line inputs). Neither is it a real problem, but it's just something I probably use a calculator most often: simply adding up a dozen of numbers, copied from somewhere as a column. So currently I must first open vim, convert it to and expression bc will handle ( 15 + 21 + 32 ...), and then paste in to bc. With kalk it would be similar. Would be great if one could skip that step since this (I assume) would be a common use-case. But, yeah, I don't have an actual suggestion on how to naturally address that.

πŸ‘€krickπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

I usually use the interactive Python prompt when doing calculations, but kalk takes it up a notch. Well done!

(The pre-built Linux binary segfaults before it can show the result on my ArchLinux box, but the cargo installed one works like a charm.)

πŸ‘€kseistrupπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

`√2` works but `√-1` doesn't, which surprised me a bit. I' expect unary `-` to bind tighter, but in this context it considers that it's a binary operator between `√` and `-1`. If you put parens it works of course.
πŸ‘€simiasπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

For fun, try to run this: `2 + 2 * 10%` in all calculators you have access to: on you phone, on your desktop, in kalk.

As they say, "the answer will surprise you" :)

πŸ‘€dmitriidπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

For what it’s worth, my first session went like this:

  >> e^iΟ€+1
  2.6974097548 + 2.6435590641i
  >> e^iΟ€
  1.6974097548 + 2.6435590641i
In fairness, I still don’t know where β€œe” comes from in complex number notation. The transition from cos(angle) + i sin(angle) seems to become β€œe^i(angle), lol” and no one explains it further. Before I started doing signal processing, I too would have thought that e^i pi is something like 1.69 + 2.64, so it’s correct, in a certain sense. But perhaps not the common mathematical sense.

EDIT: Ah, I see the problem. I suspected that e^iΟ€ was being turned into Ο€e^i incorrectly, but when I typed the open parenthesis for e^() and put my cursor inside it, typing "i" resulted in e^i() rather than e^(i). So it was impossible to parenthesize correctly, and I assumed e^iΟ€ had the usual meaning.

πŸ‘€sillysaurusxπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

This is somewhat similar to my project at https://calcula.tech, although the usecase is a bit different. There are a few other calculators around that use Rust + WASM which is kind of interesting
πŸ‘€fish45πŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

If everybody adds his/her rust+wasm+calculator projects in the comments, let me jump in as well with mine :) https://bbodi.github.io/notecalc3/

Nice work btw!

πŸ‘€bbodiπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

Can you support big numbers?

When I input 3^4^5, it outputs infinity.

πŸ‘€artfulhippoπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

An interactive calculator that passes the 0.1+0.2 test, very nice.
πŸ‘€jeroenhdπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

I'm a big fan of https://qalculate.github.io/. It has a nice GUI which can be used interchangeably with the CLI version.

It also has units, many built-in physical constants, currency conversion, matrices and probably tons of other stuff I don't know about.

I don't think it can be easily ran in a browser though.

πŸ‘€kqbxπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

This seems off:

    >> f(x) = x^2 
    >> f''(4)
    0.9995297887
πŸ‘€BootvisπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

Nice work! And you beat me to the name "Kalk", I've had a private github repo with a calculator with that name for a while, though mine takes sort of the opposite approach, input and manipulation is very visual.
πŸ‘€GrustafπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

Any interest in adding more symbolic stuff? There often isn't really any reason to do derivatives numerically. While I was looking at the derivatives I noticed the word "quotinent" should be "quotient" in the readme.
πŸ‘€eigenketπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

Would love to have TeX syntax support for this one, as I'm so used to typing it.
πŸ‘€sp1ritπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

This is really nice and all, but what I (and probably many others) would love is an alternative to `bc`. It's so useful but also so limited.
πŸ‘€HDMI_CableπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

Pity it's not in homebrew. I realize I can manually download a binary and manually install it and make a note somewhere where I got it from in case I forget and then periodically re-check manually if an update is out, or just never install any updates, but I'm trying to not do that if it can be helped.
πŸ‘€dividedbyzeroπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

Kudos to the author, it seems a very nice calculator program.

Any chance in the future that Kalk will support quaternion numbers[1]?

[1]https://en.wikipedia.org/wiki/Quaternion

πŸ‘€teleforceπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

ah beautiful, i was hoping a cli-ified/updated version of the already wonderful OpalCalc would come into existence!
πŸ‘€0_gravitasπŸ•‘4yπŸ”Ό0πŸ—¨οΈ0