Skip to main content

random-complex

A package for the most basic complex random sampling.

from random_complex import crandomn
import matplotlib.pyplot as plt

x = crandomn(size=1000000)

plt.figure(figsize=(6, 6), dpi=300)
plt.hexbin(x.real, x.imag, gridsize=(173, 100), lw=0.2, extent=(-2.5, +2.5, -2.5, +2.5))
plt.xlim((-2.5, +2.5))
plt.ylim((-2.5, +2.5))
plt.xlabel('Re(x)')
plt.ylabel('Im(x)')
plt.show()

png

Installation

pip install random-complex

Usage

This package provides three functions, that mimic their corresponding numpy.random analogon.

crandomu

crandomu(size=None, dtype=np.complex128, out=None)

Random uniform sampling from the complex unit circle:

from random_complex import crandomu

x = crandomu(size=1000000)

plt.figure(figsize=(6, 6), dpi=300)
plt.hexbin(x.real, x.imag, gridsize=(173, 100), lw=0.2, extent=(-1.1, +1.1, -1.1, +1.1))
plt.xlim((-1.1, +1.1))
plt.ylim((-1.1, +1.1))
plt.xlabel('Re(x)')
plt.ylabel('Im(x)')
plt.show()

png

crandom

crandom(size=None, dtype=np.complex128, out=None)

Random uniform sampling from within complex unit circle:

from random_complex import crandom

x = crandom(size=1000000)

plt.figure(figsize=(6, 6), dpi=300)
plt.hexbin(x.real, x.imag, gridsize=(173, 100), lw=0.2, extent=(-1.1, +1.1, -1.1, +1.1))
plt.xlim((-1.1, +1.1))
plt.ylim((-1.1, +1.1))
plt.xlabel('Re(x)')
plt.ylabel('Im(x)')
plt.show()

png

crandomn

crandomn(loc=0j, scale=((1, 0), (0, 1)), size=None, dtype=np.complex128, out=None)

Normal distributed sampling on the complex plane. See first image, or here with unequal variance.

from random_complex import crandomn

x = crandomn(scale=((1, 0.5), (0.5, 0.5)), size=1000000)

plt.figure(figsize=(6, 6), dpi=300)
plt.hexbin(x.real, x.imag, gridsize=(173, 100), lw=0.2, extent=(-2.5, +2.5, -2.5, +2.5))
plt.xlim((-2.5, +2.5))
plt.ylim((-2.5, +2.5))
plt.xlabel('Re(x)')
plt.ylabel('Im(x)')
plt.show()

png

Metadata

Release files for complex-random 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for complex-random 0.9.0
File Size Uploaded
complex-random-0.9.0.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for complex-random 0.9.0
File Interpreter ABI Platform
complex_random-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / complex-random-0.9.0.tar.gz

Download URL complex-random-0.9.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bae451555b93d892fa8e9effdfac9083f0a407ab7d43bd2d2eb97c48d9d2c0d7
BLAKE2b-256 checksum
How to use checksums
d0f646b72058005e3b0f34b135a93bc07aa049a443404cbc961988a9026749f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / complex_random-0.9.0-py3-none-any.whl

Download URL complex_random-0.9.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a9e615d157b0c92924fe28778854ca619611bbfdcf5a61232084b500f50e03a
BLAKE2b-256 checksum
How to use checksums
7d960fc11980b9ef03ab2c4cd6bfda692c40c391c04345291f8c2177856c07b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page