atan

 

Description

Calculates the arctangent of x.

Syntax

double atan( double x )
complex atan( complex x )

Parameters

x
[input] Can be either real of complex number.

Return

The atan function returns the arctangent of x.

Examples

EX1

#include <origin.h>
//This program computes and displays the arctangent of x.
int test_atan()
{
    double vv;
    vv = atan(1);
    out_double("atan(1)=", vv);        //output should be atan(1)=0.7854
    ASSERT( is_equal(vv, PI/4) );
    vv = atan(0);
    out_double("atan(0)=", vv);        //output should be atan(0)=0
    ASSERT( is_equal(vv, 0) );
    vv = atan(-1);
    out_double("atan(-1)=", vv);    //output should be atan(-1)=-0.7854
    ASSERT( is_equal(vv, -PI/4) );
    
    return 1;
}

EX2

#include <Origin.h>

int test_atan()
{
    complex vv;
    vv = atan(1+1i);        
    out_complex("atan(1+1i) =", vv);  //output should be atan(1+1i) =1.017222+0.402359i
     
    return 1;
}

Remark

See Also

tan, tanh

header to Include

origin.h

Reference