add math functions.

fix some bugs like exceptions…
invalid variable name
invalid functions