Cosine integral function
cosint(
returns
the cosine
integral function of X
)X
.
Depending on its arguments, cosint
returns
floating-point or exact symbolic results.
Compute the cosine integral function for these numbers. Because
these numbers are not symbolic objects, cosint
returns
floating-point results.
A = cosint([- 1, 0, pi/2, pi, 1])
A = 0.3374 + 3.1416i -Inf + 0.0000i 0.4720 + 0.0000i... 0.0737 + 0.0000i 0.3374 + 0.0000i
Compute the cosine integral function for the numbers converted
to symbolic objects. For many symbolic (exact) numbers, cosint
returns
unresolved symbolic calls.
symA = cosint(sym([- 1, 0, pi/2, pi, 1]))
symA = [ cosint(1) + pi*1i, -Inf, cosint(pi/2), cosint(pi), cosint(1)]
Use vpa
to approximate symbolic results
with floating-point numbers:
vpa(symA)
ans = [ 0.33740392290096813466264620388915... + 3.1415926535897932384626433832795i,... -Inf,... 0.47200065143956865077760610761413,... 0.07366791204642548599010096523015,... 0.33740392290096813466264620388915]
Plot the cosine integral function on the interval from 0 to 4*pi
.
syms x fplot(cosint(x),[0 4*pi]) grid on
Many functions, such as diff
and int
,
can handle expressions containing cosint
.
Find the first and second derivatives of the cosine integral function:
syms x diff(cosint(x), x) diff(cosint(x), x, x)
ans = cos(x)/x ans = - cos(x)/x^2 - sin(x)/x
Find the indefinite integral of the cosine integral function:
int(cosint(x), x)
ans = x*cosint(x) - sin(x)
[1] Gautschi, W. and W. F. Cahill. “Exponential Integral and Related Functions.” Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. (M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.