I am wondering if there is an 'easy' way to calculate expressions like (a-b)^x for x > 2 (because writing a*a + 2*a*b + b*b isnt as complicated as for x == 4^^)... Or in general: for every x... Is there some solution including recursive function calls?... I dont want to use a math library...
I had to do something like this a while ago. I ended up with the recursive way to calculate combinations because doing it with factorials and double precision arithmetic didn't always give me the right result. Mind that it will only work if x is a(n) (positive) integer, and it will be very slow (for big values of x). I guess you could speed it up by caching some combinations into a map or something.
The problem are the combinations of any factor, that will exist for higher exponents... i thought about something with string parsing... but that will hurt my time management :D...