How can I do math on fields? I am trying to learn the principals required to make a Drupal 7 math/calculator module that simply takes user's inputs and does some math on them and then displays the results on the same page without a page refresh.
Drupal modules are basically PHP code, and because PHP is on the server side, you cannot do mathematical actions upon user's input without submitting your data to the server(Which will refresh your page).

The only solution to do what you want is to add some Javasciprt to do it for you.

Here is a tutorial explaining how to add JS to Drupal

https://www.drupal.org/node/756722