Goto main content

cos

This function computes the cos of a number.

COS

NAME

cos - This function computes the cos of a number.

SYNOPSIS

cos(number)

DESCRIPTION

This mathematical function allows the user to compute the cos of an argument defined in radians. Radians are the standart angles used in mathematics due to their relation with the trigonometric circle, which is a circle of radius 1. A radian is 57,3 degrees. For explanation on how to change your argument from radians to degrees, see the Examples section. :)

PARAMETERS

Number
Specify the number (float) used as argument for the cos function.

RETURN

Cos
The cos value of the argument.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

One can use this function with degrees (using this other function called deg2rad):

test(q(res={_{
%include "/includes/extenso.sn";
function deg2rad(value)
        return value / 57.3;
endf
cos(deg2rad(180));
}}.),
q(res=-1.));

With radians:

test(q(res={_{
%include "/includes/extenso.sn";
cos(2*PI);}}.),
q(res=1.));

With integers:

test(q(res={_{cos(45);}}.),q(res=.525322.));

Note that when using a number greater than 2PI, the function will simply go around the
circle until reaching the number. For example, cos(4PI)=1 since it only means
that the function went around the circle twice. The only possible answers are
those of the trigonometric circle.

With other variables:

test(q(res={_{
%include "/includes/extenso.sn";
a=PI;
cos(a);
}}.),
q(res=-1.));

With another trigonometric function:

test(q(res={_{
%include "/includes/extenso.sn";
a=sin(0);
cos(a);
}}.),
q(res=1.));

SEE ALSO

{{ include("includes/maths.sn") }}

AUTHOR

Written by Caroline Laplante, <claplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.