blob: cbdf5ca2da37e2d8e907d76f58660d4e98218290 [file] [log] [blame]
@cindex exponential function
@cindex exp
The functions described in this section are declared in the header file
@file{gsl_sf_exp.h}.
@menu
* Exponential Function::
* Relative Exponential Functions::
* Exponentiation With Error Estimate::
@end menu
@node Exponential Function
@subsection Exponential Function
@deftypefun double gsl_sf_exp (double @var{x})
@deftypefunx int gsl_sf_exp_e (double @var{x}, gsl_sf_result * @var{result})
These routines provide an exponential function @math{\exp(x)} using GSL
semantics and error checking.
@comment Exceptional Return Values: GSL_EOVRFLW, GSL_EUNDRFLW
@end deftypefun
@deftypefun int gsl_sf_exp_e10_e (double @var{x}, gsl_sf_result_e10 * @var{result})
This function computes the exponential @math{\exp(x)} using the
@code{gsl_sf_result_e10} type to return a result with extended range.
This function may be useful if the value of @math{\exp(x)} would
overflow the numeric range of @code{double}.
@comment Exceptional Return Values: GSL_EOVRFLW, GSL_EUNDRFLW
@end deftypefun
@deftypefun double gsl_sf_exp_mult (double @var{x}, double @var{y})
@deftypefunx int gsl_sf_exp_mult_e (double @var{x}, double @var{y}, gsl_sf_result * @var{result})
These routines exponentiate @var{x} and multiply by the factor @var{y}
to return the product @math{y \exp(x)}.
@comment Exceptional Return Values: GSL_EOVRFLW, GSL_EUNDRFLW
@end deftypefun
@deftypefun int gsl_sf_exp_mult_e10_e (const double @var{x}, const double @var{y}, gsl_sf_result_e10 * @var{result})
This function computes the product @math{y \exp(x)} using the
@code{gsl_sf_result_e10} type to return a result with extended numeric
range.
@comment Exceptional Return Values: GSL_EOVRFLW, GSL_EUNDRFLW
@end deftypefun
@node Relative Exponential Functions
@subsection Relative Exponential Functions
@deftypefun double gsl_sf_expm1 (double @var{x})
@deftypefunx int gsl_sf_expm1_e (double @var{x}, gsl_sf_result * @var{result})
These routines compute the quantity @math{\exp(x)-1} using an algorithm
that is accurate for small @math{x}.
@comment Exceptional Return Values: GSL_EOVRFLW
@end deftypefun
@deftypefun double gsl_sf_exprel (double @var{x})
@deftypefunx int gsl_sf_exprel_e (double @var{x}, gsl_sf_result * @var{result})
These routines compute the quantity @math{(\exp(x)-1)/x} using an
algorithm that is accurate for small @math{x}. For small @math{x} the
algorithm is based on the expansion @math{(\exp(x)-1)/x = 1 + x/2 +
x^2/(2*3) + x^3/(2*3*4) + \dots}.
@comment Exceptional Return Values: GSL_EOVRFLW
@end deftypefun
@deftypefun double gsl_sf_exprel_2 (double @var{x})
@deftypefunx int gsl_sf_exprel_2_e (double @var{x}, gsl_sf_result * @var{result})
These routines compute the quantity @math{2(\exp(x)-1-x)/x^2} using an
algorithm that is accurate for small @math{x}. For small @math{x} the
algorithm is based on the expansion @math{2(\exp(x)-1-x)/x^2 =
1 + x/3 + x^2/(3*4) + x^3/(3*4*5) + \dots}.
@comment Exceptional Return Values: GSL_EOVRFLW
@end deftypefun
@deftypefun double gsl_sf_exprel_n (int @var{n}, double @var{x})
@deftypefunx int gsl_sf_exprel_n_e (int @var{n}, double @var{x}, gsl_sf_result * @var{result})
These routines compute the @math{N}-relative exponential, which is the
@var{n}-th generalization of the functions @code{gsl_sf_exprel} and
@code{gsl_sf_exprel2}. The @math{N}-relative exponential is given by,
@tex
\beforedisplay
$$
\eqalign{
\hbox{exprel}_N(x)
&= N!/x^N \left(\exp(x) - \sum_{k=0}^{N-1} x^k/k!\right)\cr
&= 1 + x/(N+1) + x^2/((N+1)(N+2)) + \dots\cr
&= {}_1F_1(1,1+N,x)\cr
}
$$
\afterdisplay
@end tex
@ifinfo
@example
exprel_N(x) = N!/x^N (\exp(x) - \sum_@{k=0@}^@{N-1@} x^k/k!)
= 1 + x/(N+1) + x^2/((N+1)(N+2)) + ...
= 1F1 (1,1+N,x)
@end example
@end ifinfo
@comment Exceptional Return Values:
@end deftypefun
@node Exponentiation With Error Estimate
@subsection Exponentiation With Error Estimate
@deftypefun int gsl_sf_exp_err_e (double @var{x}, double @var{dx}, gsl_sf_result * @var{result})
This function exponentiates @var{x} with an associated absolute error
@var{dx}.
@comment Exceptional Return Values:
@end deftypefun
@deftypefun int gsl_sf_exp_err_e10_e (double @var{x}, double @var{dx}, gsl_sf_result_e10 * @var{result})
This function exponentiates a quantity @var{x} with an associated absolute
error @var{dx} using the @code{gsl_sf_result_e10} type to return a result with
extended range.
@comment Exceptional Return Values:
@end deftypefun
@deftypefun int gsl_sf_exp_mult_err_e (double @var{x}, double @var{dx}, double @var{y}, double @var{dy}, gsl_sf_result * @var{result})
This routine computes the product @math{y \exp(x)} for the quantities
@var{x}, @var{y} with associated absolute errors @var{dx}, @var{dy}.
@comment Exceptional Return Values: GSL_EOVRFLW, GSL_EUNDRFLW
@end deftypefun
@deftypefun int gsl_sf_exp_mult_err_e10_e (double @var{x}, double @var{dx}, double @var{y}, double @var{dy}, gsl_sf_result_e10 * @var{result})
This routine computes the product @math{y \exp(x)} for the quantities
@var{x}, @var{y} with associated absolute errors @var{dx}, @var{dy} using the
@code{gsl_sf_result_e10} type to return a result with extended range.
@comment Exceptional Return Values: GSL_EOVRFLW, GSL_EUNDRFLW
@end deftypefun