Name

assert_tancond — Computes the condition number of the tan function.

Calling Sequence

   [c,y] = assert_tancond ( 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 tan function. The tan function has a large condition number if

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

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

Examples

[c,y] = assert_tancond ( 1 )
[c,y] = assert_tancond ( 0 )     // 1
[c,y] = assert_tancond ( %pi/2 )
[c,y] = assert_tancond ( %pi )

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

   

Authors

Michael Baudin, DIGITEO, 2010