.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Math::GSL::Complex 3pm" .TH Math::GSL::Complex 3pm 2024-01-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SS \fBcopy()\fP .IX Subsection "copy()" Returns a copy of the Complex number, which resides at a different location in memory. .PP .Vb 2 \& my $z = Math::GSL::Complex\->new([10,5]); \& my $copy = $z\->copy; .Ve .SH NAME Math::GSL::Complex \- Complex Numbers .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 8 \& use Math::GSL::Complex qw/:all/; \& my $complex = Math::GSL::Complex\->new([3,2]); # creates a complex number 3+2*i \& my $real = $complex\->real; # returns the real part \& my $imag = $complex\->imag; # returns the imaginary part \& $complex\->gsl_set_real(5); # changes the real part to 5 \& $complex\->gsl_set_imag(4); # changes the imaginary part to 4 \& $complex\->gsl_set_complex(7,6); # changes it to 7 + 6*i \& ($real, $imag) = $complex\->parts; # get both at once .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Here is a list of all the functions included in this module : .ie n .IP gsl_complex_arg($z) 1 .el .IP \f(CWgsl_complex_arg($z)\fR 1 .IX Item "gsl_complex_arg($z)" Return the argument of the complex number \f(CW$z\fR .ie n .IP gsl_complex_abs($z) 1 .el .IP \f(CWgsl_complex_abs($z)\fR 1 .IX Item "gsl_complex_abs($z)" Return |$z|, the magnitude of the complex number \f(CW$z\fR .ie n .IP """gsl_complex_rect($x,$y)""" 1 .el .IP \f(CWgsl_complex_rect($x,$y)\fR 1 .IX Item "gsl_complex_rect($x,$y)" Create a complex number in cartesian form \f(CW$x\fR + \f(CW$y\fR*i .ie n .IP """gsl_complex_polar($r,$theta)""" 1 .el .IP \f(CWgsl_complex_polar($r,$theta)\fR 1 .IX Item "gsl_complex_polar($r,$theta)" Create a complex number in polar form \f(CW$r\fR*exp(i*$theta) .ie n .IP gsl_complex_abs2($z) 1 .el .IP \f(CWgsl_complex_abs2($z)\fR 1 .IX Item "gsl_complex_abs2($z)" Return |$z|^2, the squared magnitude of the complex number \f(CW$z\fR .ie n .IP gsl_complex_logabs($z) 1 .el .IP \f(CWgsl_complex_logabs($z)\fR 1 .IX Item "gsl_complex_logabs($z)" Return log(|$z|), the natural logarithm of the magnitude of the complex number \f(CW$z\fR .ie n .IP """gsl_complex_add($c1, $c2)""" 1 .el .IP "\f(CWgsl_complex_add($c1, $c2)\fR" 1 .IX Item "gsl_complex_add($c1, $c2)" Return a complex number which is the sum of the complex numbers \f(CW$c1\fR and \f(CW$c2\fR .ie n .IP """gsl_complex_sub($c1, $c2)""" 1 .el .IP "\f(CWgsl_complex_sub($c1, $c2)\fR" 1 .IX Item "gsl_complex_sub($c1, $c2)" Return a complex number which is the difference between \f(CW$c1\fR and \f(CW$c2\fR ($c1 \- \f(CW$c2\fR) .ie n .IP """gsl_complex_mul($c1, $c2)""" 1 .el .IP "\f(CWgsl_complex_mul($c1, $c2)\fR" 1 .IX Item "gsl_complex_mul($c1, $c2)" Return a complex number which is the product of the complex numbers \f(CW$c1\fR and \f(CW$c2\fR .ie n .IP """gsl_complex_div($c1, $c2)""" 1 .el .IP "\f(CWgsl_complex_div($c1, $c2)\fR" 1 .IX Item "gsl_complex_div($c1, $c2)" Return a complex number which is the quotient of the complex numbers \f(CW$c1\fR and \f(CW$c2\fR ($c1 / \f(CW$c2\fR) .ie n .IP """gsl_complex_add_real($c, $x)""" 1 .el .IP "\f(CWgsl_complex_add_real($c, $x)\fR" 1 .IX Item "gsl_complex_add_real($c, $x)" Return the sum of the complex number \f(CW$c\fR and the real number \f(CW$x\fR .ie n .IP """gsl_complex_sub_real($c, $x)""" 1 .el .IP "\f(CWgsl_complex_sub_real($c, $x)\fR" 1 .IX Item "gsl_complex_sub_real($c, $x)" Return the difference of the complex number \f(CW$c\fR and the real number \f(CW$x\fR .ie n .IP """gsl_complex_mul_real($c, $x)""" 1 .el .IP "\f(CWgsl_complex_mul_real($c, $x)\fR" 1 .IX Item "gsl_complex_mul_real($c, $x)" Return the product of the complex number \f(CW$c\fR and the real number \f(CW$x\fR .ie n .IP """gsl_complex_div_real($c, $x)""" 1 .el .IP "\f(CWgsl_complex_div_real($c, $x)\fR" 1 .IX Item "gsl_complex_div_real($c, $x)" Return the quotient of the complex number \f(CW$c\fR and the real number \f(CW$x\fR .ie n .IP """gsl_complex_add_imag($c, $y)""" 1 .el .IP "\f(CWgsl_complex_add_imag($c, $y)\fR" 1 .IX Item "gsl_complex_add_imag($c, $y)" Return sum of the complex number \f(CW$c\fR and the imaginary number i*$x .ie n .IP """gsl_complex_sub_imag($c, $y)""" 1 .el .IP "\f(CWgsl_complex_sub_imag($c, $y)\fR" 1 .IX Item "gsl_complex_sub_imag($c, $y)" Return the diffrence of the complex number \f(CW$c\fR and the imaginary number i*$x .ie n .IP """gsl_complex_mul_imag($c, $y)""" 1 .el .IP "\f(CWgsl_complex_mul_imag($c, $y)\fR" 1 .IX Item "gsl_complex_mul_imag($c, $y)" Return the product of the complex number \f(CW$c\fR and the imaginary number i*$x .ie n .IP """gsl_complex_div_imag($c, $y)""" 1 .el .IP "\f(CWgsl_complex_div_imag($c, $y)\fR" 1 .IX Item "gsl_complex_div_imag($c, $y)" Return the quotient of the complex number \f(CW$c\fR and the imaginary number i*$x .ie n .IP gsl_complex_conjugate($c) 1 .el .IP \f(CWgsl_complex_conjugate($c)\fR 1 .IX Item "gsl_complex_conjugate($c)" Return the conjugate of the of the complex number \f(CW$c\fR (x \- i*y) .ie n .IP gsl_complex_inverse($c) 1 .el .IP \f(CWgsl_complex_inverse($c)\fR 1 .IX Item "gsl_complex_inverse($c)" Return the inverse, or reciprocal of the complex number \f(CW$c\fR (1/$c) .ie n .IP gsl_complex_negative($c) 1 .el .IP \f(CWgsl_complex_negative($c)\fR 1 .IX Item "gsl_complex_negative($c)" Return the negative of the complex number \f(CW$c\fR (\-x \-i*y) .ie n .IP gsl_complex_sqrt($c) 1 .el .IP \f(CWgsl_complex_sqrt($c)\fR 1 .IX Item "gsl_complex_sqrt($c)" Return the square root of the complex number \f(CW$c\fR .ie n .IP gsl_complex_sqrt_real($x) 1 .el .IP \f(CWgsl_complex_sqrt_real($x)\fR 1 .IX Item "gsl_complex_sqrt_real($x)" Return the complex square root of the real number \f(CW$x\fR, where \f(CW$x\fR may be negative .ie n .IP """gsl_complex_pow($c1, $c2)""" 1 .el .IP "\f(CWgsl_complex_pow($c1, $c2)\fR" 1 .IX Item "gsl_complex_pow($c1, $c2)" Return the complex number \f(CW$c1\fR raised to the complex power \f(CW$c2\fR .ie n .IP """gsl_complex_pow_real($c, $x)""" 1 .el .IP "\f(CWgsl_complex_pow_real($c, $x)\fR" 1 .IX Item "gsl_complex_pow_real($c, $x)" Return the complex number raised to the real power \f(CW$x\fR .ie n .IP gsl_complex_exp($c) 1 .el .IP \f(CWgsl_complex_exp($c)\fR 1 .IX Item "gsl_complex_exp($c)" Return the complex exponential of the complex number \f(CW$c\fR .ie n .IP gsl_complex_log($c) 1 .el .IP \f(CWgsl_complex_log($c)\fR 1 .IX Item "gsl_complex_log($c)" Return the complex natural logarithm (base e) of the complex number \f(CW$c\fR .ie n .IP gsl_complex_log10($c) 1 .el .IP \f(CWgsl_complex_log10($c)\fR 1 .IX Item "gsl_complex_log10($c)" Return the complex base\-10 logarithm of the complex number \f(CW$c\fR .ie n .IP """gsl_complex_log_b($c, $b)""" 1 .el .IP "\f(CWgsl_complex_log_b($c, $b)\fR" 1 .IX Item "gsl_complex_log_b($c, $b)" Return the complex base\-$b of the complex number \f(CW$c\fR .ie n .IP gsl_complex_sin($c) 1 .el .IP \f(CWgsl_complex_sin($c)\fR 1 .IX Item "gsl_complex_sin($c)" Return the complex sine of the complex number \f(CW$c\fR .ie n .IP gsl_complex_cos($c) 1 .el .IP \f(CWgsl_complex_cos($c)\fR 1 .IX Item "gsl_complex_cos($c)" Return the complex cosine of the complex number \f(CW$c\fR .ie n .IP gsl_complex_sec($c) 1 .el .IP \f(CWgsl_complex_sec($c)\fR 1 .IX Item "gsl_complex_sec($c)" Return the complex secant of the complex number \f(CW$c\fR .ie n .IP gsl_complex_csc($c) 1 .el .IP \f(CWgsl_complex_csc($c)\fR 1 .IX Item "gsl_complex_csc($c)" Return the complex cosecant of the complex number \f(CW$c\fR .ie n .IP gsl_complex_tan($c) 1 .el .IP \f(CWgsl_complex_tan($c)\fR 1 .IX Item "gsl_complex_tan($c)" Return the complex tangent of the complex number \f(CW$c\fR .ie n .IP gsl_complex_cot($c) 1 .el .IP \f(CWgsl_complex_cot($c)\fR 1 .IX Item "gsl_complex_cot($c)" Return the complex cotangent of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arcsin($c) 1 .el .IP \f(CWgsl_complex_arcsin($c)\fR 1 .IX Item "gsl_complex_arcsin($c)" Return the complex arcsine of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arcsin_real($x) 1 .el .IP \f(CWgsl_complex_arcsin_real($x)\fR 1 .IX Item "gsl_complex_arcsin_real($x)" Return the complex arcsine of the real number \f(CW$x\fR .ie n .IP gsl_complex_arccos($c) 1 .el .IP \f(CWgsl_complex_arccos($c)\fR 1 .IX Item "gsl_complex_arccos($c)" Return the complex arccosine of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arccos_real($x) 1 .el .IP \f(CWgsl_complex_arccos_real($x)\fR 1 .IX Item "gsl_complex_arccos_real($x)" Return the complex arccosine of the real number \f(CW$x\fR .ie n .IP gsl_complex_arcsec($c) 1 .el .IP \f(CWgsl_complex_arcsec($c)\fR 1 .IX Item "gsl_complex_arcsec($c)" Return the complex arcsecant of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arcsec_real($x) 1 .el .IP \f(CWgsl_complex_arcsec_real($x)\fR 1 .IX Item "gsl_complex_arcsec_real($x)" Return the complex arcsecant of the real number \f(CW$x\fR .ie n .IP gsl_complex_arccsc($c) 1 .el .IP \f(CWgsl_complex_arccsc($c)\fR 1 .IX Item "gsl_complex_arccsc($c)" Return the complex arccosecant of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arccsc_real($x) 1 .el .IP \f(CWgsl_complex_arccsc_real($x)\fR 1 .IX Item "gsl_complex_arccsc_real($x)" Return the complex arccosecant of the real number \f(CW$x\fR .ie n .IP gsl_complex_arctan($c) 1 .el .IP \f(CWgsl_complex_arctan($c)\fR 1 .IX Item "gsl_complex_arctan($c)" Return the complex arctangent of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arccot($c) 1 .el .IP \f(CWgsl_complex_arccot($c)\fR 1 .IX Item "gsl_complex_arccot($c)" Return the complex arccotangent of the complex number \f(CW$c\fR .ie n .IP gsl_complex_sinh($c) 1 .el .IP \f(CWgsl_complex_sinh($c)\fR 1 .IX Item "gsl_complex_sinh($c)" Return the complex hyperbolic sine of the complex number \f(CW$c\fR .ie n .IP gsl_complex_cosh($c) 1 .el .IP \f(CWgsl_complex_cosh($c)\fR 1 .IX Item "gsl_complex_cosh($c)" Return the complex hyperbolic cosine of the complex number \f(CW$cy\fR .ie n .IP gsl_complex_sech($c) 1 .el .IP \f(CWgsl_complex_sech($c)\fR 1 .IX Item "gsl_complex_sech($c)" Return the complex hyperbolic secant of the complex number \f(CW$c\fR .ie n .IP gsl_complex_csch($c) 1 .el .IP \f(CWgsl_complex_csch($c)\fR 1 .IX Item "gsl_complex_csch($c)" Return the complex hyperbolic cosecant of the complex number \f(CW$c\fR .ie n .IP gsl_complex_tanh($c) 1 .el .IP \f(CWgsl_complex_tanh($c)\fR 1 .IX Item "gsl_complex_tanh($c)" Return the complex hyperbolic tangent of the complex number \f(CW$c\fR .ie n .IP gsl_complex_coth($c) 1 .el .IP \f(CWgsl_complex_coth($c)\fR 1 .IX Item "gsl_complex_coth($c)" Return the complex hyperbolic cotangent of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arcsinh($c) 1 .el .IP \f(CWgsl_complex_arcsinh($c)\fR 1 .IX Item "gsl_complex_arcsinh($c)" Return the complex hyperbolic arcsine of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arccosh($c) 1 .el .IP \f(CWgsl_complex_arccosh($c)\fR 1 .IX Item "gsl_complex_arccosh($c)" Return the complex hyperbolic arccosine of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arccosh_real($x) 1 .el .IP \f(CWgsl_complex_arccosh_real($x)\fR 1 .IX Item "gsl_complex_arccosh_real($x)" Return the complex hyperbolic arccosine of the real number \f(CW$x\fR .ie n .IP gsl_complex_arcsech($c) 1 .el .IP \f(CWgsl_complex_arcsech($c)\fR 1 .IX Item "gsl_complex_arcsech($c)" Return the complex hyperbolic arcsecant of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arccsch($c) 1 .el .IP \f(CWgsl_complex_arccsch($c)\fR 1 .IX Item "gsl_complex_arccsch($c)" Return the complex hyperbolic arccosecant of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arctanh($c) 1 .el .IP \f(CWgsl_complex_arctanh($c)\fR 1 .IX Item "gsl_complex_arctanh($c)" Return the complex hyperbolic arctangent of the complex number \f(CW$c\fR .ie n .IP gsl_complex_arctanh_real($x) 1 .el .IP \f(CWgsl_complex_arctanh_real($x)\fR 1 .IX Item "gsl_complex_arctanh_real($x)" Return the complex hyperbolic arctangent of the real number \f(CW$x\fR .ie n .IP gsl_complex_arccoth($c) 1 .el .IP \f(CWgsl_complex_arccoth($c)\fR 1 .IX Item "gsl_complex_arccoth($c)" Return the complex hyperbolic arccotangent of the complex number \f(CW$c\fR .ie n .IP gsl_real($z) 1 .el .IP \f(CWgsl_real($z)\fR 1 .IX Item "gsl_real($z)" Return the real part of \f(CW$z\fR .ie n .IP gsl_imag($z) 1 .el .IP \f(CWgsl_imag($z)\fR 1 .IX Item "gsl_imag($z)" Return the imaginary part of \f(CW$z\fR .ie n .IP gsl_parts($z) 1 .el .IP \f(CWgsl_parts($z)\fR 1 .IX Item "gsl_parts($z)" Return a list of the real and imaginary parts of \f(CW$z\fR .ie n .IP """gsl_set_real($z, $x)""" 1 .el .IP "\f(CWgsl_set_real($z, $x)\fR" 1 .IX Item "gsl_set_real($z, $x)" Sets the real part of \f(CW$z\fR to \f(CW$x\fR .ie n .IP """gsl_set_imag($z, $y)""" 1 .el .IP "\f(CWgsl_set_imag($z, $y)\fR" 1 .IX Item "gsl_set_imag($z, $y)" Sets the imaginary part of \f(CW$z\fR to \f(CW$y\fR .ie n .IP """gsl_set_complex($z, $x, $h)""" 1 .el .IP "\f(CWgsl_set_complex($z, $x, $h)\fR" 1 .IX Item "gsl_set_complex($z, $x, $h)" Sets the real part of \f(CW$z\fR to \f(CW$x\fR and the imaginary part to \f(CW$y\fR .SH EXAMPLES .IX Header "EXAMPLES" This code defines \f(CW$z\fR as 6 + 4*i, takes the complex conjugate of that number, then prints it out. .Sp .Vb 4 \& my $z = gsl_complex_rect(6,4); \& my $y = gsl_complex_conjugate($z); \& my ($real, $imag) = gsl_parts($y); \& print "z = $real + $imag*i\en"; .Ve .PP This code defines \f(CW$z\fR as 5 + 3*i, multiplies it by 2 and then prints it out. .Sp .Vb 5 \& my $x = gsl_complex_rect(5,3); \& my $z = gsl_complex_mul_real($x, 2); \& my $real = gsl_real($z); \& my $imag = gsl_imag($z); \& print "Re(\e$z) = $real\en"; .Ve .SH AUTHORS .IX Header "AUTHORS" Jonathan "Duke" Leto and Thierry Moisan .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2008\-2023 Jonathan "Duke" Leto and Thierry Moisan .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.