📜  如何使用示例找到反正切

📅  最后修改于: 2021-05-28 02:25:21             🧑  作者: Mango

什么是反正切?

反正切是切线函数的倒数。它返回切线为给定数字的角度。

catan()头文件中的内置函数,该函数返回任何常数的复数反正切(或反正切),该常数在闭区间[-i, + i] (其中i代表iota),用于评估复杂对象,例如z在虚轴上,而要确定是实数还是整数的复杂对象,则在内部调用以下预定义方法:

S.No.

Method 

Return Type

1.

atan() function takes a complex z of datatype double which determine arc tangent for real complex numbers

Returns complex arc tangent lies in a range along real axis [-PI/2, +PI/2] for an argument of type double.

2.

atanf() function takes a complex z of datatype float double which determine arc tangent for real complex numbers.

Returns complex arc tangent lies in a range along real axis [-PI/2, +PI/2] for an argument of type float.

3.

atanl() function takes a complex z of datatype long double which determine arc tangent for real complex numbers

Returns complex arc tangent lies in a range along real axis [-PI/2, +PI/2] for an argument of type long double.

4.

catan() function takes a complex z of datatype double which also allows imaginary part of complex numbers Returns complex arc tangent lies in a range along imaginary axis [-i, +i] for a complex object of type double

5.

catanf()  function takes a complex z of datatype float double which also allows imaginary part of complex numbers Returns complex arc tangent lies in a range along imaginary axis [-i, +i] for a complex object of type float

6.

catanl()  function takes a complex z of datatype long double which also allows imaginary part of complex numbers Returns complex arc tangent lies in a range along imaginary axis [-i, +i] for a complex object of type long double

句法:

atan(double arg);
atanf(float arg);
atanl(long double arg);
where arg is a floating-point value

catan(double complex z);
catanf(float complex z);
catanl( long double complex z);
where z is a Type – generic macro

参数:这些函数接受一个强制参数z ,该参数指定反正切。该参数可以是double,float或long double数据类型。

返回值:该函数根据传递的参数的类型返回复杂的圆弧切线/圆弧切线。

下面的程序说明了上述方法:

程序1该程序将说明函数atan()atanf()atanl()计算浮点参数的反正切的主值。如果由于下溢而导致量程错误,则四舍五入后将返回正确的结果。

C
// C program to illustrate the use
// of functions atan(), atanf(),
// and atanl()
#include 
#include 
  
// Driver Code
int main()
{
    // For function atan()
    printf("atan(1) = %lf, ",
           atan(1));
    printf(" 4*atan(1)=%lf\n",
           4 * atan(1));
  
    printf("atan(-0.0) = %+lf, ",
           atan(-0.0));
    printf("atan(+0.0) = %+lf\n",
           atan(0));
  
    // For special values INFINITY
    printf("atan(Inf) = %lf, ",
           atan(INFINITY));
    printf("2*atan(Inf) = %lf\n\n",
           2 * atan(INFINITY));
  
    // For function atanf()
    printf("atanf(1.1) = %f, ",
           atanf(1.1));
    printf("4*atanf(1.5)=%f\n",
           4 * atanf(1.5));
  
    printf("atanf(-0.3) = %+f, ",
           atanf(-0.3));
    printf("atanf(+0.3) = %+f\n",
           atanf(0.3));
  
    // For special values INFINITY
    printf("atanf(Inf) = %f, ",
           atanf(INFINITY));
    printf("2*atanf(Inf) = %f\n\n",
           2 * atanf(INFINITY));
  
    // For function atanl()
    printf("atanl(1.1) = %Lf, ",
           atanl(1.1));
    printf("4*atanl(1.7)=%Lf\n",
           4 * atanl(1.7));
  
    printf("atanl(-1.3) = %+Lf, ",
           atanl(-1.3));
    printf("atanl(+0.3) = %+Lf\n",
           atanl(0.3));
  
    // For special values INFINITY
    printf("atanl(Inf) = %Lf, ",
           atanl(INFINITY));
    printf("2*atanl(Inf) = %Lf\n\n",
           2 * atanl(INFINITY));
  
    return 0;
}


C
// C program to illustrate the use
// of functions catan(), catanf(),
// and catanl()
#include 
#include 
#include 
  
// Driver Code
int main()
{
    // Given Complex Number
    double complex z1 = catan(2 * I);
  
    // Function catan()
    printf("catan(+0 + 2i) = %lf + %lfi\n",
           creal(z1), cimag(z1));
  
    // Complex(0, + INFINITY)
    double complex z2 = 2
                        * catan(2 * I * DBL_MAX);
    printf("2*catan(+0 + i*Inf) = %lf%+lfi\n",
           creal(z2), cimag(z2));
  
    printf("\n");
  
    // Function catanf()
    float complex z3 = catanf(2 * I);
    printf("catanf(+0 + 2i) = %f + %fi\n",
           crealf(z3), cimagf(z3));
  
    // Complex(0, + INFINITY)
    float complex z4 = 2
                       * catanf(2 * I * DBL_MAX);
    printf("2*catanf(+0 + i*Inf) = %f + %fi\n",
           crealf(z4), cimagf(z4));
  
    printf("\n");
  
    // Function catanl()
    long double complex z5 = catanl(2 * I);
    printf("catan(+0+2i) = %Lf%+Lfi\n",
           creall(z5), cimagl(z5));
  
    // Complex(0, + INFINITY)
    long double complex z6 = 2
                             * catanl(2 * I * DBL_MAX);
    printf("2*catanl(+0 + i*Inf) = %Lf + %Lfi\n",
           creall(z6), cimagl(z6));
}


C
// C program to illustrate the use
// of functions  catanh(), catanhf(),
// and catanhl()
#include 
#include 
  
// Driver Code
int main()
{
    // Function catanh()
    double complex z1 = catanh(2);
    printf("catanh(+2+0i) = %lf%+lfi\n",
           creal(z1), cimag(z1));
  
    // for any z, atanh(z) = atan(iz)/i
    // I denotes Imaginary
    // part of the complex number
    double complex z2 = catanh(1 + 2 * I);
    printf("catanh(1+2i) = %lf%+lfi\n\n",
           creal(z2), cimag(z2));
  
    // Function catanhf()
    float complex z3 = catanhf(2);
    printf("catanhf(+2+0i) = %f%+fi\n",
           crealf(z3), cimagf(z3));
  
    // for any z, atanh(z) = atan(iz)/i
    float complex z4 = catanhf(1 + 2 * I);
    printf("catanhf(1+2i) = %f%+fi\n\n",
           crealf(z4), cimagf(z4));
  
    // Function catanh()
    long double complex z5 = catanhl(2);
    printf("catanhl(+2+0i) = %Lf%+Lfi\n",
           creall(z5), cimagl(z5));
  
    // for any z, atanh(z) = atan(iz)/i
    long double complex z6 = catanhl(1 + 2 * I);
    printf("catanhl(1+2i) = %Lf%+Lfi\n\n",
           creall(z6), cimagl(z6));
}


输出:
atan(1) = 0.785398,  4*atan(1)=3.141593
atan(-0.0) = -0.000000, atan(+0.0) = +0.000000
atan(Inf) = 1.570796, 2*atan(Inf) = 3.141593

atanf(1.1) = 0.832981, 4*atanf(1.5)=3.931175
atanf(-0.3) = -0.291457, atanf(+0.3) = +0.291457
atanf(Inf) = 1.570796, 2*atanf(Inf) = 3.141593

atanl(1.1) = 0.832981, 4*atanl(1.7)=4.156289
atanl(-1.3) = -0.915101, atanl(+0.3) = +0.291457
atanl(Inf) = 1.570796, 2*atanl(Inf) = 3.141593

程序2该程序将说明函数catan()catanf()catanl()计算复数反正切线的主值作为参数。

C

// C program to illustrate the use
// of functions catan(), catanf(),
// and catanl()
#include 
#include 
#include 
  
// Driver Code
int main()
{
    // Given Complex Number
    double complex z1 = catan(2 * I);
  
    // Function catan()
    printf("catan(+0 + 2i) = %lf + %lfi\n",
           creal(z1), cimag(z1));
  
    // Complex(0, + INFINITY)
    double complex z2 = 2
                        * catan(2 * I * DBL_MAX);
    printf("2*catan(+0 + i*Inf) = %lf%+lfi\n",
           creal(z2), cimag(z2));
  
    printf("\n");
  
    // Function catanf()
    float complex z3 = catanf(2 * I);
    printf("catanf(+0 + 2i) = %f + %fi\n",
           crealf(z3), cimagf(z3));
  
    // Complex(0, + INFINITY)
    float complex z4 = 2
                       * catanf(2 * I * DBL_MAX);
    printf("2*catanf(+0 + i*Inf) = %f + %fi\n",
           crealf(z4), cimagf(z4));
  
    printf("\n");
  
    // Function catanl()
    long double complex z5 = catanl(2 * I);
    printf("catan(+0+2i) = %Lf%+Lfi\n",
           creall(z5), cimagl(z5));
  
    // Complex(0, + INFINITY)
    long double complex z6 = 2
                             * catanl(2 * I * DBL_MAX);
    printf("2*catanl(+0 + i*Inf) = %Lf + %Lfi\n",
           creall(z6), cimagl(z6));
}
输出:
catan(+0 + 2i) = 1.570796 + 0.549306i
2*catan(+0 + i*Inf) = 3.141593+0.000000i

catanf(+0 + 2i) = 1.570796 + 0.549306i
2*catanf(+0 + i*Inf) = 3.141593 + 0.000000i

catan(+0+2i) = 1.570796+0.549306i
2*catanl(+0 + i*Inf) = 3.141593 + 0.000000i

方案3:此程序将说明的功能catanh(),catanhf(),catanhl()计算z的复杂弧双曲正切沿着实轴,在区间[-i * PI / 2,+ I * PI / 2]沿假想轴。

C

// C program to illustrate the use
// of functions  catanh(), catanhf(),
// and catanhl()
#include 
#include 
  
// Driver Code
int main()
{
    // Function catanh()
    double complex z1 = catanh(2);
    printf("catanh(+2+0i) = %lf%+lfi\n",
           creal(z1), cimag(z1));
  
    // for any z, atanh(z) = atan(iz)/i
    // I denotes Imaginary
    // part of the complex number
    double complex z2 = catanh(1 + 2 * I);
    printf("catanh(1+2i) = %lf%+lfi\n\n",
           creal(z2), cimag(z2));
  
    // Function catanhf()
    float complex z3 = catanhf(2);
    printf("catanhf(+2+0i) = %f%+fi\n",
           crealf(z3), cimagf(z3));
  
    // for any z, atanh(z) = atan(iz)/i
    float complex z4 = catanhf(1 + 2 * I);
    printf("catanhf(1+2i) = %f%+fi\n\n",
           crealf(z4), cimagf(z4));
  
    // Function catanh()
    long double complex z5 = catanhl(2);
    printf("catanhl(+2+0i) = %Lf%+Lfi\n",
           creall(z5), cimagl(z5));
  
    // for any z, atanh(z) = atan(iz)/i
    long double complex z6 = catanhl(1 + 2 * I);
    printf("catanhl(1+2i) = %Lf%+Lfi\n\n",
           creall(z6), cimagl(z6));
}
输出:
catanh(+2+0i) = 0.549306+1.570796i
catanh(1+2i) = 0.173287+1.178097i

catanhf(+2+0i) = 0.549306+1.570796i
catanhf(1+2i) = 0.173287+1.178097i

catanhl(+2+0i) = 0.549306+1.570796i
catanhl(1+2i) = 0.173287+1.178097i

想要从精选的最佳视频中学习和练习问题,请查看《基础知识到高级C的C基础课程》。