EXP(3) - [MATHEMATICS] Base-e exponential function
result = exp(x)
elemental TYPE(kind=KIND) function exp(x)TYPE(kind=KIND),intent(in) :: x
o X may be real or complex of any kind. o The return value has the same type and kind as X.
EXP(3) returns the value of e (the base of natural logarithms) raised to the power of X.
"e" is also known as Euler’s constant.
If X is of type complex, its imaginary part is regarded as a value in radians such that if (see Euler’s formula):
cx=(re,im)then
exp(cx) = exp(re) * cmplx(cos(im),sin(im),kind=kind(cx))Since EXP(3) is the inverse function of LOG(3) the maximum valid magnitude of the real component of X is LOG(HUGE(X)).
o X : The type shall be real or complex.
The value of the result is E**X where E is Euler’s constant.
If X is of type complex, its imaginary part is regarded as a value in radians.
Sample program:
program demo_exp implicit none real :: x, re, im complex :: cxResults:x = 1.0 write(*,*)"Euler’s constant is approximately",exp(x)
!! complex values ! given re=3.0 im=4.0 cx=cmplx(re,im)
! complex results from complex arguments are Related to Euler’s formula write(*,*)’given the complex value ’,cx write(*,*)’exp(x) is’,exp(cx) write(*,*)’is the same as’,exp(re)*cmplx(cos(im),sin(im),kind=kind(cx))
! exp(3) is the inverse function of log(3) so ! the real component of the input must be less than or equal to write(*,*)’maximum real component’,log(huge(0.0)) ! or for double precision write(*,*)’maximum doubleprecision component’,log(huge(0.0d0))
! but since the imaginary component is passed to the cos(3) and sin(3) ! functions the imaginary component can be any real value
end program demo_exp
> Euler’s constant is approximately 2.71828175 > given the complex value (3.00000000,4.00000000) > exp(x) is (-13.1287832,-15.2007847) > is the same as (-13.1287832,-15.2007847) > maximum real component 88.7228394 > maximum doubleprecision component 709.78271289338397
FORTRAN 77
o LOG(3)
Fortran intrinsic descriptions (license: MIT) @urbanjost
o Wikipedia:Exponential function o Wikipedia:Euler’s formula