Namespaces
Variants

ccosf, ccos, ccosl

From cppreference.net
Definiert im Header <complex.h>
float complex ccosf ( float complex z ) ;
(1) (seit C99)
double complex ccos ( double complex z ) ;
(2) (seit C99)
long double complex ccosl ( long double complex z ) ;
(3) (seit C99)
Definiert im Header <tgmath.h>
#define cos( z )
(4) (seit C99)
1-3) Berechnet den komplexen Kosinus von z .
4) Typgenerisches Makro: Wenn z den Typ long double complex hat, wird ccosl aufgerufen. Wenn z den Typ double complex hat, wird ccos aufgerufen. Wenn z den Typ float complex hat, wird ccosf aufgerufen. Wenn z reell oder ganzzahlig ist, ruft das Makro die entsprechende reelle Funktion auf ( cosf , cos , cosl ). Wenn z imaginär ist, ruft das Makro die entsprechende reelle Version der Funktion cosh auf, implementiert die Formel cos(iy) = cosh(y) und der Rückgabetyp ist reell.

Inhaltsverzeichnis

Parameter

z - komplexes Argument

Rückgabewert

Wenn keine Fehler auftreten, wird der komplexe Kosinus von z zurückgegeben.

Fehler und Sonderfälle werden behandelt, als ob die Operation durch ccosh ( I * z ) implementiert wäre.

Hinweise

Der Kosinus ist eine ganze Funktion auf der komplexen Ebene und hat keine Verzweigungsschnitte.

Mathematical definition of the cosine is cos z =
e iz
+e -iz
2

Beispiel

#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
    double complex z = ccos(1);  // verhält sich wie reeller Kosinus entlang der reellen Achse
    printf("cos(1+0i) = %f%+fi ( cos(1)=%f)\n", creal(z), cimag(z), cos(1));
    double complex z2 = ccos(I); // verhält sich wie reeller Kosinus hyperbolicus entlang der imaginären Achse
    printf("cos(0+1i) = %f%+fi (cosh(1)=%f)\n", creal(z2), cimag(z2), cosh(1));
}

Ausgabe:

cos(1+0i) = 0.540302-0.000000i ( cos(1)=0.540302)
cos(0+1i) = 1.543081-0.000000i (cosh(1)=1.543081)

Referenzen

  • C11-Standard (ISO/IEC 9899:2011):
  • 7.3.5.4 The ccos functions (S. 191)
  • 7.25 Type-generic math <tgmath.h> (S. 373-375)
  • G.7 Type-generic math <tgmath.h> (S. 545)
  • C99-Standard (ISO/IEC 9899:1999):
  • 7.3.5.4 The ccos functions (S. 173)
  • 7.22 Type-generic math <tgmath.h> (S. 335-337)
  • G.7 Type-generic math <tgmath.h> (S. 480)

Siehe auch

(C99) (C99) (C99)
berechnet den komplexen Sinus
(Funktion)
(C99) (C99) (C99)
berechnet den komplexen Tangens
(Funktion)
(C99) (C99) (C99)
berechnet den komplexen Arkuskosinus
(Funktion)
(C99) (C99)
berechnet den Kosinus ( cos(x) )
(Funktion)