Fortran provides a variety of built-in trigonometric functions that allow you to perform common trigonometric calculations.
These functions operate on angles expressed in radians.
Here are some of the commonly used trigonometric functions in Fortran:
- Sine:
SIN(x)- Computes the sine of the angle
x.
- Computes the sine of the angle
- Cosine:
COS(x)- Calculates the cosine of the angle
x.
- Calculates the cosine of the angle
- Tangent:
TAN(x)- Computes the tangent of the angle
x.
- Computes the tangent of the angle
- Arcsine:
ASIN(x)- Calculates the inverse sine, returning the angle whose sine is
x.
- Calculates the inverse sine, returning the angle whose sine is
- Arccosine:
ACOS(x)- Computes the inverse cosine, returning the angle whose cosine is
x.
- Computes the inverse cosine, returning the angle whose cosine is
- Arctangent:
ATAN(x)orATAN2(y, x)ATAN(x)calculates the inverse tangent, returning the angle whose tangent isx.ATAN2(y, x)calculates the inverse tangent of the ratioy/x, returning the angle in the appropriate quadrant.
- Hyperbolic Sine:
SINH(x)- Calculates the hyperbolic sine of the angle
x.
- Calculates the hyperbolic sine of the angle
- Hyperbolic Cosine:
COSH(x)- Computes the hyperbolic cosine of the angle
x.
- Computes the hyperbolic cosine of the angle
- Hyperbolic Tangent:
TANH(x)- Calculates the hyperbolic tangent of the angle
x.
- Calculates the hyperbolic tangent of the angle
- Exponential Function:
EXP(x)- Computes the exponential of the angle
x.
- Computes the exponential of the angle
- Natural Logarithm:
LOG(x)- Calculates the natural logarithm (base
e) ofx.
- Calculates the natural logarithm (base
- Common Logarithm:
LOG10(x) or LOG2(x)- Computes the logarithm base 10 or base 2 of
x. (Program Example – LOG, LOG2, LOG10 – FORTRAN)
- Computes the logarithm base 10 or base 2 of
These functions are part of the standard Fortran language and are available in most Fortran compilers.
They can be used to perform various trigonometric and exponential calculations required in scientific and engineering applications.