If you need a calculator with units support: Maxima
If you need a calculator, with ability to do symbolic maths, bigints, plotting and support for units, there is no need to build on from scratch… Maxima is free, long-established, and can be run via Jupyter (see for a fixed-up dockererised version, try out on BinderHub note may take some time to start for first time while binderhub rebuilds the container).
It supports units using the bult-in ezunits module:
load ("ezunits")$
load ("physical_constants")$
For example:
1`kg + 1`g;
is by default printed in its original symbolic form:
\[\mathrm{kg}+1\;\mathrm{g}\]But can be converted to grams using:
% `` g;
\(1001\;\mathrm{g}\)
Or to kilograms:
% `` kg, numer;
\[1.001\;\mathrm{kg}\]
There are built-in physics constsants too:
%c;
\[c\]
The numerical value can be seen with:
constvalue(%c) ;
\[299792458\;\frac{\mathrm{m}}{\mathrm{s}}\]
Or in different units:
constvalue(%c) `` cm / s , numer;
\[2.99792458 \times 10^{+10}\;\frac{\mathrm{cm}}{\mathrm{s}}\]
All the formating shown here is built-in but sometimes it needs a bit of fixing up:
100000` Pa `` psi, numer;
gives the greek letter not, pounds-square-inch:
\[14.50377377302092\;\psi\]You can try out all this and all the other Maxima features on BinderHub .