Predefined Functions – exp
Function name: | exp – Exponential function |
Synopsis: | exp(x) |
Input data type | Output data type |
---|---|
real | real |
complex | complex |
quaternion | quaternion |
Description:
ChaosPro automatically detects the input data type.
In order to calculate exp(z)
(z = any complex number) ChaosPro performs the following calculation:
exp(z)=exp(x)*cos(y)+i*exp(x)*sin(y)
In order to calculate exp(q)
(q = any quaternion number) ChaosPro performs the following calculation:
quaternion fr_exp(quaternion q) { quaternion ret; n = sqrt( sqr(real(loquat(q))) + sqr(imag(loquat(q))) +sqr(imag(q)) ); ex = exp(real(q)); f = ex*sin(n); if (n != 0.0) { f = f/n; } c0 = ex*cos(n); c1 = f*imag(q); c2 = f*real(loquat(q)); c3 = f*imag(loquat(q)); ret = loquat(c2+flip(c3))+c0+flip(c1); return(ret); }