Live data from Hacker News

Show HN: Kalk, A calculator with math syntax, complex numbers

kalk.strct.net

21–30 of 90 posts

Re: Show HN: Kalk, A calculator with math syntax, complex numbers

#21
post #20
post #18

This seems off: >> f(x) = x^2 >> f''(4) 0.9995297887

Oh yeah, derivatives of higher order being less accurate is a known problem. I forgot to specify that, thanks!

Maybe best to just disable it for now, I played with e^x as well and the results were off as well.

Ignoring these, I really like Kalk!

Re: Show HN: Kalk, A calculator with math syntax, complex numbers

#22
post #21
post #20

Earlier quoted context omitted.

Oh yeah, derivatives of higher order being less accurate is a known problem. I forgot to specify that, thanks!

Maybe best to just disable it for now, I played with e^x as well and the results were off as well. Ignoring these, I really like Kalk!

Thank you! Yeah, or at least give a warning.

Re: Show HN: Kalk, A calculator with math syntax, complex numbers

#23
post #2

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.

Congrats! I write calculators myself from time to time, but this sounds very impressive :) How was your experience using webassembly? Any good guides that helped you with that part?

Re: Show HN: Kalk, A calculator with math syntax, complex numbers

#24
post #22
post #21

Earlier quoted context omitted.

Maybe best to just disable it for now, I played with e^x as well and the results were off as well. Ignoring these, I really like Kalk!

Thank you! Yeah, or at least give a warning.

Beautiful Web GUI, beautiful source code, "cargo install kalk_cli" && it works like a charm! Thanks for sharing this.

Re: Show HN: Kalk, A calculator with math syntax, complex numbers

#25
post #2

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.

Congrats! I write calculators myself from time to time, but this sounds very impressive :) How was your experience using webassembly? Any good guides that helped you with that part?

It was actually surprisingly seamless with Rust. "wasmpack" pretty much did it all for me. I added some attributes (well, whatever they're called in Rust) to function and struct declaration to show that bindings should be generated for these things, and from that wasmpack could generate JavaScript bindings! Unfortunately I was slightly limited by some libraries not working with WebAssembly, but I got around that fairly easily.

Re: Show HN: Kalk, A calculator with math syntax, complex numbers

#29

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" :)

Performing the calculation with Soulver did not surprise me (being what I calculated in my head ahead of time):

    2 + 2 × 10% = 2.2
At the risk of admitting my ignorance, yet more interested in learning something new: should this answer (2.2) surprise me?

Re: Show HN: Kalk, A calculator with math syntax, complex numbers

#30
post #25

Earlier quoted context omitted.

Congrats! I write calculators myself from time to time, but this sounds very impressive :) How was your experience using webassembly? Any good guides that helped you with that part?

It was actually surprisingly seamless with Rust. "wasmpack" pretty much did it all for me. I added some attributes (well, whatever they're called in Rust) to function and struct declaration to show that bindings should be generated for these things, and from that wasmpack could generate JavaScript bindings! Unfortunately I was slightly limited by some libraries not working with WebAssembly, but I got around that fair…

That’s great to hear - thanks for the insight. And kudos again on a great project, definitely not easy to get all this functionality!
Post reply on HN