sin Programmers Guide Contents | Index |  Search

Category:intervals,math Component type:function
Prototype
template <class Tnum>
interval<Tnum> sin(const interval<Tnum>& x) ;
Description
Computes the trigonometric sine of an interval. If the interval's left bound is not less than 0 or if its right bound is greater than 2*pi, then it will print
`bad argument for restricted sine of [x,y]`
where x and y are the bounds of the interval and will return NaN.
``` distance_left = right(x) - piby2()
distance_right = piby2() - left(x)
sin(x) =
if (piby2 & x) != empty:
[-1.0,1.0]                if sup(x & pi3by2) != 0 and inf(x & pi3by2) != 0
[sin(sup(x),1.0]          if inf(distance_right) > sup(distance_left)
[sin(inf(x),1.0]          else if inf(distance_left) > sup(distance_right)
[sin(sup(x),1.0]          else if sin(inf(x)) > sin(sup(x))
[sin(inf(x),1.0]          else
if (pi3by2 & x) != empty:
[-1.0,sin(sup(x))]        if inf(distance_right) > sup(distance_left)
[-1.0,sin(inf(x))]        if inf(distance_left) > sup(distance_right)
[-1.0,sin(sup(x))]        else if sin(sup(x)) > sin(left(x))
[-1.0,sin(inf(x))]        else
if sup(x) < inf(piby2) or inf(x) > sup(pi3by2):
[sin(inf(x)),sin(sup(x))]
else:
[sin(sup(x)),sin(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