Name

assert_coscond — Computes the condition number of the cos function.

Calling Sequence

   [c,y] = assert_coscond ( x )
   
   

Parameters

x :

a n-by-m matrix of doubles

c :

a n-by-m matrix of doubles, the condition number

y :

a n-by-m, matrix of doubles, the function values

Description

Computes the condition number of the cos function. The cos function has a large condition number if

  • x is large,
  • x-pi/2 is an integer multiple of pi (where cos(x)=0).

<latex> \begin{eqnarray} c(x) = \left| \frac{x \sin(x)}{\cos(x)} \right| \end{eqnarray} </latex>

Examples

[c,y] = assert_coscond ( 1 ) // ~1
[c,y] = assert_coscond ( %pi/2 ) // ~10^16

assert_plotcond ( "cos" , linspace(-4,4,1000) );

   

Authors

Michael Baudin, DIGITEO, 2010