Fix `pow` to handle negative exponents. Fix for #179

@certik @thilinarmtb  I've updated `pow` more or less the way it was in SymPy version, atleast for the case of `Number`
However, in some cases `Mul` gets a negative pow. Currently in case of Mul we just call `power_all_terms`
So I added a check in `power_all_terms`. Can you review if this is the right way to go about fixing it?