This could be a good candidate for a custom search command. See http://www.splunk.com/base/Documentation/latest/SearchReference/Aboutcustomsearchcommands for info on how to roll your own.
Something else to consider is filing an ER (Enhancement request) for either providing additional mathematical functions in eval (If you're going to do cosine -- you might as well do sine, secant, and tangent) or providing a way to create user-defined
eval functions. (Assuming, of course, that the API for an
eval UDF would have any benefit at all over a custom search command. I am not certain if this is the case or not)
Approximate functions like cosine or sine using its Taylor series!
Write a stanza in macros.conf that defines cosine as an approximation using its Taylor series.
description = calculates an approximate value for cosine of x
definition = eval cosineX=(1 - ((xx)/2) + ((xxxx)/(432)) - ....)
And add as many terms as you'd like - as you add more terms your approximation of cosine of x will start to converge to the actual value.