complex - basics of complex mathematics


   #include <complex.h>


   Complex  numbers  are  numbers of the form z = a+b*i, where a and b are
   real numbers and i = sqrt(-1), so that i*i = -1.
   There are other ways to represent that number.  The pair (a,b) of  real
   numbers  may  be  viewed  as  a  point in the plane, given by X- and Y-
   coordinates.  This same point may also be described by giving the  pair
   of  real  numbers (r,phi), where r is the distance to the origin O, and
   phi the angle between the X-axis and the line Oz.  Now z = r*exp(i*phi)
   = r*(cos(phi)+i*sin(phi)).

   The basic operations are defined on z = a+b*i and w = c+d*i as:

   addition: z+w = (a+c) + (b+d)*i

   multiplication: z*w = (a*c - b*d) + (a*d + b*c)*i

   division: z/w = ((a*c + b*d)/(c*c + d*d)) + ((b*c - a*d)/(c*c + d*d))*i

   Nearly  all math function have a complex counterpart but there are some
   complex-only functions.


   Your C-compiler can work with complex numbers if it  supports  the  C99
   standard.  Link with -lm.  The imaginary unit is represented by I.

   /* check that exp(i * pi) == -1 */
   #include <math.h>        /* for atan */
   #include <stdio.h>
   #include <complex.h>

       double pi = 4 * atan(1.0);
       double complex z = cexp(I * pi);
       printf("%f + %f * i\n", creal(z), cimag(z));


   cabs(3),  cacos(3),  cacosh(3), carg(3), casin(3), casinh(3), catan(3),
   catanh(3), ccos(3), ccosh(3),  cerf(3),  cexp(3),  cexp2(3),  cimag(3),
   clog(3),  clog10(3),  clog2(3),  conj(3),  cpow(3), cproj(3), creal(3),
   csin(3), csinh(3), csqrt(3), ctan(3), ctanh(3)


   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at

                              2011-09-16                        COMPLEX(7)

More Linux Commands

setnetent(3) - get network entry (Library - Linux man page)
The getnetent() function reads the next entry from the networks database and returns a netent structure containing the broken-out fields from the entry. A conne

XkbAllocGeomOverlayKey(3) - Allocate keys in an overlay row
XkbAllocGeomOverlayKey.3 - Xkb provides a number of functions to allocate and free subcomponents of a keyboard geometry. Use these functions to create or modify

getresuid32(2) - get real, effective and saved user/group ID
getresuid() returns the real UID, the effective UID, and the saved set-user-ID of the calling process, in the arguments ruid, euid, and suid, respectively. getr

form_request_name(3form) - handle printable form request nam
The function form_request_name returns the printable name of a form request code. The function form_request_by_name searches in the name-table for a request wit

gst-visualise-0.10(1) - Run a GStreamer pipeline to display
gst-visualise is a tool that is used to run a basic GStreamer pipeline, to display a graphical visualisation of an audio stream. By default, the audio stream is

TAP::Parser::Grammar(3pm) - A grammar for the Test Anything
TAP::Parser::Grammar tokenizes lines from a TAP::Parser::Iterator and constructs TAP::Parser::Result subclasses to represent the tokens. Do not attempt to use t

field_index(3form) - set and get form page number (ManPage)
The function set_current field sets the current field of the given form; current_field returns the current field of the given form. The function set_form_page s

gnutls_x509_crq_set_pubkey(3) - API function (Man Page).....
gnutls_x509_crq_set_pubkey.3 - This function will set the public parameters from the given public key to the request. RETURNS On success, GNUTLS_E_SUCCESS (0) i

yppoll(8) - return version and master server of a NIS map...
yppoll OPTIONS -h host Ask the NIS server process running on host for information about mapname. If host is not specified, the server polled is the default serv

XmbDrawString(3) - draw text using a single font set........
The XmbDrawString, XwcDrawString and Xutf8DrawString functions draw the specified text with the foreground pixel. When the XFontSet has missing charsets, each u

perlgpl(1) - the GNU General Public License, version 1......
Perl is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software F

dirmngr-client(1) - CRL and OCSP daemon - Linux manual page
The dirmngr-client is a simple tool to contact a running dirmngr and test whether a certificate has been revoked --either by being listed in the corresponding C

We can't live, work or learn in freedom unless the software we use is free.