1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>COS Trigonometric Cosine Function
</TITLE>
</HEAD>
<BODY>
<H2>COS Trigonometric Cosine Function
</H2>
<P>
Section: <A HREF=sec_mathfunctions.html> Mathematical Functions </A>
<H3>Usage</H3>
Computes the <code>cos</code> function for its argument. The general
syntax for its use is
<PRE>
y = cos(x)
</PRE>
<P>
where <code>x</code> is an <code>n</code>-dimensional array of numerical type.
Integer types are promoted to the <code>double</code> type prior to
calculation of the <code>cos</code> function. Output <code>y</code> is of the
same size and type as the input <code>x</code>, (unless <code>x</code> is an
integer, in which case <code>y</code> is a <code>double</code> type).
<H3>Function Internals</H3>
Mathematically, the <code>cos</code> function is defined for all real
valued arguments <code>x</code> by the infinite summation
<P>
<DIV ALIGN="CENTER">
<IMG SRC="cos_eqn1.png">
</DIV>
<P>
For complex valued arguments <code>z</code>, the cosine is computed via
<P>
<DIV ALIGN="CENTER">
<IMG SRC="cos_eqn2.png">
</DIV>
<P>
<H3>Example</H3>
The following piece of code plots the real-valued <code>cos(2 pi x)</code>
function over one period of <code>[0,1]</code>:
<PRE>
--> x = linspace(0,1);
--> plot(x,cos(2*pi*x))
</PRE>
<P>
<P>
<DIV ALIGN="CENTER">
<IMG SRC="cosplot.png">
</DIV>
<P>
</BODY>
</HTML>
|