+ 5

# How to create a pow() function?

I want to create a pow function to return a^b, but also want it to return a correct value if b<0, like 1/2, 1/3, 1/4 etc... How can I achieve this via a for loop? How to multiply 5 , 0.4325 times?

6 Answers

+ 8

Find the Taylor expansion of the function x^b and calculate the polynomial. You need to know the derivative of x^b which is b*x^(b-1).

+ 8

No problem, here's a nifty tool to calculate Taylor series of a function:
http://www.wolframalpha.com/widgets/view.jsp?id=f9476968629e1163bd4a3ba839d60925

+ 4

Thank You, @JPM7

+ 3

Yes, this exists, but what if I want to define it myself?

+ 3

@Frost
How will that work differently w.r.t. a for loop?
What change will I bring each time?

+ 3

@Helioform
Thank You!!