$sc = CreateObject("ScriptControl")
$sc.Language = "jscript"
$result = $sc.Eval("Math.cos("+$numValue+")")
$sc = 0
$Cosine = $result
$testvalue = 45
$test = Cosine($testvalue)
? "cosine of $testvalue is: "+$test
If you run this, it will display the result:
cosine of 45 is: 0.52532198881773
I didn't really need to define $testvalue first and then pass it into the Cosine() function that way. I could have entered the explicit value as the argument as well, such as Cosine(45). I hope this helps.