Math::...omplex(3pm)
π Math::GSL::Complex β Complex Numbers bestie π
okay so hi, welcome to Math::GSL::Complex (she's a Perl module, she lives in the 3pm manual, and she does complex numbers, which is literally the best kind of number). This page is your group chat with her. Let's go. π
copy() π«Ά
Gives you a copy of the Complex number β and like, an actual copy, chillin' at a different location in memory. Not the same girl, just the same vibe. π
my $z = Math::GSL::Complex->new([10,5]);
my $copy = $z->copy;
β¨ NAME β¨
Math::GSL::Complex β Complex Numbers, periodt.
π SYNOPSIS π
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
like look at her go. iconic. πΈ
π DESCRIPTION π
Bestie. Sit down. Here is a list of all the functions included in this module β every single one, no skips, no notes-app shortcuts:
gsl_complex_arg($z)β gives you the argument of the complex number$zβ¨gsl_complex_abs($z)β gives you|$z|, aka the magnitude of the complex number$zπgsl_complex_rect($x,$y)β makes a complex number in cartesian form$x + $y*iπgsl_complex_polar($r,$theta)β makes a complex number in polar form$r*exp(i*$theta)π¦gsl_complex_abs2($z)β gives you|$z|^2, the squared magnitude of the complex number$zπgsl_complex_logabs($z)β gives youlog(|$z|), the natural log of the magnitude of the complex number$zπΈgsl_complex_add($c1, $c2)β gives you a complex number that's the sum of$c1and$c2β¨gsl_complex_sub($c1, $c2)β gives you a complex number that's the difference between$c1and$c2($c1 - $c2) πgsl_complex_mul($c1, $c2)β gives you a complex number that's the product of$c1and$c2π₯gsl_complex_div($c1, $c2)β gives you a complex number that's the quotient of$c1and$c2($c1 / $c2) πgsl_complex_add_real($c, $x)β the sum of the complex number$cand the real number$xπgsl_complex_sub_real($c, $x)β the difference of the complex number$cand the real number$xπ¦gsl_complex_mul_real($c, $x)β the product of the complex number$cand the real number$xπgsl_complex_div_real($c, $x)β the quotient of the complex number$cand the real number$xπgsl_complex_add_imag($c, $y)β the sum of the complex number$cand the imaginary numberi*$xβ¨gsl_complex_sub_imag($c, $y)β the diffrence of the complex number$cand the imaginary numberi*$xπΈgsl_complex_mul_imag($c, $y)β the product of the complex number$cand the imaginary numberi*$xπ₯gsl_complex_div_imag($c, $y)β the quotient of the complex number$cand the imaginary numberi*$xπgsl_complex_conjugate($c)β the conjugate of the of the complex number$c(x - i*y) πgsl_complex_inverse($c)β the inverse, aka the reciprocal, of the complex number$c(1/$c) πgsl_complex_negative($c)β the negative of the complex number$c(-x -i*y) π¦gsl_complex_sqrt($c)β the square root of the complex number$cπgsl_complex_sqrt_real($x)β the complex square root of the real number$x, where$xmay be negative (yes bestie, negative, she can hold it) πgsl_complex_pow($c1, $c2)β the complex number$c1raised to the complex power$c2β¨gsl_complex_pow_real($c, $x)β the complex number raised to the real power$xπ₯gsl_complex_exp($c)β the complex exponential of the complex number$cπΈgsl_complex_log($c)β the complex natural log (base e) of the complex number$cπgsl_complex_log10($c)β the complex base-10 log of the complex number$cπgsl_complex_log_b($c, $b)β the complex base-$bof the complex number$cπgsl_complex_sin($c)β the complex sine of the complex number$cπ¦gsl_complex_cos($c)β the complex cosine of the complex number$cπgsl_complex_sec($c)β the complex secant of the complex number$cπgsl_complex_csc($c)β the complex cosecant of the complex number$cβ¨gsl_complex_tan($c)β the complex tangent of the complex number$cπ₯gsl_complex_cot($c)β the complex cotangent of the complex number$cπΈgsl_complex_arcsin($c)β the complex arcsine of the complex number$cπgsl_complex_arcsin_real($x)β the complex arcsine of the real number$xπgsl_complex_arccos($c)β the complex arccosine of the complex number$cπgsl_complex_arccos_real($x)β the complex arccosine of the real number$xπ¦gsl_complex_arcsec($c)β the complex arcsecant of the complex number$cπgsl_complex_arcsec_real($x)β the complex arcsecant of the real number$xπgsl_complex_arccsc($c)β the complex arccosecant of the complex number$cβ¨gsl_complex_arccsc_real($x)β the complex arccosecant of the real number$xπ₯gsl_complex_arctan($c)β the complex arctangent of the complex number$cπΈgsl_complex_arccot($c)β the complex arccotangent of the complex number$cπgsl_complex_sinh($c)β the complex hyperbolic sine of the complex number$cπgsl_complex_cosh($c)β the complex hyperbolic cosine of the complex number$cyπgsl_complex_sech($c)β the complex hyperbolic secant of the complex number$cπ¦gsl_complex_csch($c)β the complex hyperbolic cosecant of the complex number$cπgsl_complex_tanh($c)β the complex hyperbolic tangent of the complex number$cπgsl_complex_coth($c)β the complex hyperbolic cotangent of the complex number$cβ¨gsl_complex_arcsinh($c)β the complex hyperbolic arcsine of the complex number$cπ₯gsl_complex_arccosh($c)β the complex hyperbolic arccosine of the complex number$cπΈgsl_complex_arccosh_real($x)β the complex hyperbolic arccosine of the real number$xπgsl_complex_arcsech($c)β the complex hyperbolic arcsecant of the complex number$cπgsl_complex_arccsch($c)β the complex hyperbolic arccosecant of the complex number$cπgsl_complex_arctanh($c)β the complex hyperbolic arctangent of the complex number$cπ¦gsl_complex_arctanh_real($x)β the complex hyperbolic arctangent of the real number$xπgsl_complex_arccoth($c)β the complex hyperbolic arccotangent of the complex number$cπgsl_real($z)β the real part of$zβ¨gsl_imag($z)β the imaginary part of$zπ₯gsl_parts($z)β a list of the real and imaginary parts of$zπΈgsl_set_real($z, $x)β sets the real part of$zto$xπgsl_set_imag($z, $y)β sets the imaginary part of$zto$yπgsl_set_complex($z, $x, $h)β sets the real part of$zto$xand the imaginary part to$yπ
the way that's SIXTY-FIVE functions. she ate and left no crumbs. π
π§ EXAMPLES π§
Example one β this code defines $z as 6 + 4*i, takes the complex conjugate of that number, then prints it out. π¦
my $z = gsl_complex_rect(6,4);
my $y = gsl_complex_conjugate($z);
my ($real, $imag) = gsl_parts($y);
print "z = $real + $imag*i\n";
Example two β this code defines $z as 5 + 3*i, multiplies it by 2 and then prints it out. π
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(\$z) = $real\n";
π AUTHORS π
Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com> β the duo, the icons, the moment. π
π COPYRIGHT AND LICENSE π
Copyright (C) 2008-2024 Jonathan "Duke" Leto and Thierry Moisan
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
okay that's the whole page bestie, no cap. this was Math::...omplex(3pm) from the User Contributed Perl Documentation, running on perl v5.42.3, dated 2026-08-20 β so go forth and make some complex numbers, main character. πβ¨π
π¦ where this page comes from
- ubuntu stonking: libmath-gsl-perl 0.49-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms