2.1.16.7.7 sin


Description

Calculate sine of a complex value.


Calculate sine of a double value.

Syntax

complex sin( complex z )


double sin( double x )

Parameters

z
[input] the complex value whose sine is sought.


x
[input] Angle in radians.

Return

The sine


The sin function returns the sines of x.

Examples

EX1

void    run_complex_sin()
{
    complex        cc(0.5, 0.8);
    
    out_complex("sin = ", sin(cc)); // Result is "sin = 0.641200+0.779386i"
}


EX2

//This program computes and displays the sines of x.

#include <origin.h>

int test_sin()
{
    double vv;
    vv = sin( 0 );
    out_double("sin(0)=", vv);        //output should be sin(0)=0
    ASSERT( is_equal(vv, 0) );
    vv = sin( PI/6);
    out_double("sin(PI/6)=", vv);    //output should be sin(PI/6)=0.5
    ASSERT(is_equal(round(vv,5), 0.5) );
    vv = sin(5.20);
    out_double("sin(5.20)=", vv);    //output should be sin(5.20)=-0.88345
    ASSERT(is_equal(round(vv,5), -0.88345) );
    
    return 1;
}

Remark

See Also

asin

Header to Include

origin.h

Reference