c+ +三角函数
C ++三角函数 (C++ Trigonometric functions)
Trigonometric functions are also called circular functions or angle functions or goniometric functions, which are used to trigonometric computations like computing cosine, sine, tangent values.
三角函数也称为圆函数或角度的功能或测角函数 ,其用于三角函数的计算等计算余弦,正弦,正切值。
三角函数列表 (List of trigonometric functions)
Here is the list of all trigonometric functions with descriptions and their syntaxes,
这是所有三角函数及其说明和语法的列表,
Trigonometric functions | Description | Syntax |
---|---|---|
cos() | It returns the cosine of an angle of x radians. | cos(x) |
sin() | It returns the sine of an angle of x radians. | sin(x) |
tan() | It returns the tangent of an angle of x radians. | tan(x) |
acos() | It returns the arc cosine of x in radians. | acos(x) |
asin() | It returns the arc sine of x in radians. | asin(x) |
atan() | It returns the arc tangent of x in radians. | atan(x) |
atan2() | It returns the arc tangent of y/x in radians. | atan2(y,x) |
三角函数 | 描述 | 句法 |
---|---|---|
cos() | 它返回x弧度角的余弦值。 | cos(x) |
罪() | 它返回x弧度角的正弦。 | sin(x) |
tan() | 它返回x弧度角的切线。 | tan(x) |
acos() | 它以弧度返回x的反余弦值。 | acos(x) |
asin() | 它以弧度返回x的反正弦值。 | asin(x) |
晒黑() | 它以弧度返回x的反正切。 | 阿坦(x) |
atan2() | 它以弧度返回y / x的反正切。 | atan2(y,x) |
C ++代码演示三角函数示例 (C++ code to demonstrate example of trigonometric functions)
// C++ code to demonstrate the example of
// trigonometric functions
#include <iostream>
#include <cmath>
using namespace std;
// main() section
int main()
{
float x;
float y;
x = 0.25;
cout<<"cos("<<x<<") : "<<cos (x)<<endl;
cout<<"sin("<<x<<") : "<<sin (x)<<endl;
cout<<"tan("<<x<<") : "<<tan (x)<<endl;
cout<<"acos("<<x<<"): "<<acos(x)<<endl;
cout<<"asin("<<x<<"): "<<asin(x)<<endl;
cout<<"atan("<<x<<"): "<<atan(x)<<endl;
y = 1.0;
cout<<"atan2("<<y<<","<<x<<"): "<<atan2(y,x)<<endl;
return 0;
}
Output
输出量
cos(0.25) : 0.968912
sin(0.25) : 0.247404
tan(0.25) : 0.255342
acos(0.25): 1.31812
asin(0.25): 0.25268
atan(0.25): 0.244979
atan2(1,0.25): 1.32582
Reference: C++ cmath header
参考: C ++ cmath标头
翻译自: https://www.includehelp.com/cpp-tutorial/trigonometric-functions.aspx
c+ +三角函数