The best way to do math on my phone I know of is the HP Prime emulator.
[0] https://apps.apple.com/us/app/graphncalc83/id744882019