Main Content

cosint

Cosine integral function

Syntax

Description

cosint(X) returns the cosine integral function of X.

example

Examples

Cosine Integral Function for Numeric and Symbolic Arguments

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 Cosine Integral Function

Plot the cosine integral function on the interval from 0 to 4*pi.

syms x
fplot(cosint(x),[0 4*pi])
grid on

Figure contains an axes object. The axes object contains an object of type functionline.

Handle Expressions Containing Cosine Integral Function

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)

Input Arguments

collapse all

Input, specified as a symbolic number, variable, expression, or function, or as a vector or matrix of symbolic numbers, variables, expressions, or functions.

More About

collapse all

Cosine Integral Function

The cosine integral function is defined as follows:

Ci(x)=γ+log(x)+0xcos(t)1tdt

Here, γ is the Euler-Mascheroni constant:

γ=limn((k=1n1k)ln(n))

References

[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.

Version History

Introduced before R2006a