The pow() function...
tony at joshua.math.ucla.edu
tony at joshua.math.ucla.edu
Thu Feb 2 07:58:03 AEST 1989
Thank you netland for all of the replies regarding my question about
the pow() function.
I received a lot fo replies regarding how inefficient the pow() function
was for flipping signs back and forth. I realize that this is
true but the only reason I wanted to do this was because of the following:
I am taking the n derivatives of a vector of cos functions
S [w] = [1, cos (w), cos (2w), ... , cos (nw)]
S [w] d/dw = [0, -sin (w), -2 sin (2w), ... , -n sin (nw)]
. . . . .
. . . . .
. . . . .
S [w] d^m/dw^m = [0, -sin (w), -2^m sin (2w), ... , -n^m sin (nw)]
The closed for solution being :
(-1)^m * (n^m) * cos (nm - mPI/2)
Since I am still testing my program I wanted to use something that
I (and my non-programming engineering friend) can see right off as
being the closed form solution.
I therefore apologize for mis-using the word elegant (I seemed to have offended
a few people) and I also apologize for posting a simplistic example (Please no
more personal attacks!).
I promise all of you people who replied that I will stop using the pow ()
as soon as everything is debugged (and to optimize the heck out of the
program)!
Thanks again for replying in the first place.
Tony
More information about the Comp.lang.c
mailing list