cos Programmers Guide Contents | Index |  Search

Category:intervals,math Component type:function
Prototype
template <class Tnum>
interval<Tnum> cos(const interval<Tnum>& x) ;
Description
Computes the trigonometric cossine of an interval. If the interval's left bound is less than 0 or if its right bound is greater than 2*pi, then it will print
`bad argument for restricted cossine of [x,y]`
where x and y are the bounds of the inteval and will return NaN.
``` cos(x) =
if !empty(x & pi):
[-1.0,cos(inf(x))]          if cos(sup(x)) <= cos(inf(x))
[-1.0,cos(sup(x))]          if cos(sup(x)) > cos(inf(x))
if inf(x) > right(pi):
[cos(inf(x)),cos(sup(x))]   if cos(inf(x)) < cos(sup(x))
[cos(sup(x)),cos(inf(x))]   if cos(inf(x)) > cos(sup(x))
else:
[cos(sup(x)),cos(inf(x))]
```
Definition
interval.cct
Preconditions
Complexity
Example
In mathfunc.cc:
```  cout << "A:" << A << endl << endl;
cout << "Square     :" << sqr(A) << endl;
cout << "Square Root:" << sqrt(A) << endl;
cout << "Tangent    :" << tan(A) << endl;
cout << "ArcTangent :" << atan(A) << endl;
cout << "Sine       :" << sin(A) << endl;
cout << "Cosine     :" << cos(A) << endl;
cout << "Arcsine    :" << asin(A) << endl;
cout << "Arcosine   :" << acos(A) << endl;
cout << "Log        :" << log(A) << endl;
cout << "Ln         :" << ln(A) << endl;
cout << "Power (A^A):" << pow(A,A) << endl;
cout << "Exponent   :" << exp(A) << endl;

```
Notes