}

zenonet

Derivative Calculator

I recently learned about derivatives in school and about how derivation rules are used to find derivatives of functions. This process seemed pretty automatable to me so I decided to take a shot at writing my own derivative calculator.

I've been using (and loving) Rust recently so using Rust for the project was an obvious choice.

I first implemented expression parsing which kept me in my comfort zone because of my experience building parsers for programming languages. After having a solid expression parser, I started implementing an algorithm for recursively deriving the expression which, to my surprise, was actually pretty straight forward. In the end, I probably stuggled most with building a feasable simplification algorithm to bring derivatives into a somewhat sane format again.

Next, I implemented transforming an expression tree into LaTeX. Building to a WASM-library was smooth as usual in the Rust world. Finally, I wrote a little JS-page to call the WASM-lib and render the produced derivatives using KaTeX

The derivative calculator is available online though note that it's in german since it might be used by a few people from my school. Also keep in mind that this means that the decimal separator is a ','. Ew, I know.