Ray Yates
: mivascript at, pcinet d0t com
02/09/2012 11:07 a.m.
02/09/2012 11:07 a.m.
A bug in acos(x) causes it to return cos(x). This is true through version 5.14. The derivitive function below was provided by Jon Burchmore and returns the correct value.
<MvFUNCTION
NAME
="
arccos
"
PARAMETERS
="
val
"
STANDARDOUTPUTLEVEL
=""
>
<MvASSIGN
NAME
="
l.negval
"
VALUE
="
{ 0 - l.val }
>"
<MvFUNCTIONRETURN
VALUE
="
{ atan( l.negval / sqrt( l.negval * l.val + 1 ) ) + 2 * atan( 1 ) }
>"
</MvFUNCTION>