Skip to main content

Built and signed on GitHub Actions

A package provides implementation of complex numbers and mathematical functions for complex numbers.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
4 months ago (1.1.1)
function pow
pow(
a: complex,
n: number,
): complex

Returns the n-th power of a complex number.

Examples

Example 1

import { ComplexMath, cmplx } from "@babia/complex";

ComplexMath.pow(cmplx(0, 0), 4); // 0 + 0i
ComplexMath.pow(cmplx(3, 1), 4); // ≈ 28 + 96i

Parameters

a: complex

A complex number

A real number

Return Type

complex
pow(
a: complex,
b: complex,
): complex

Raises the complex number to the complex b-th power.

Examples

Example 1

import { ComplexMath, cmplx } from "@babia/complex";

const i = cmplx(0, 1);

ComplexMath.pow(i, i); // i^i = e^(-pi / 2) = 0.20787957635076193

Parameters

a: complex

A complex number

b: complex

The complex b-th power

Return Type

complex

Add Package

deno add jsr:@babia/complex

Import symbol

import { pow } from "@babia/complex/math";

---- OR ----

Import directly with a jsr specifier

import { pow } from "jsr:@babia/complex/math";

Add Package

npx jsr add @babia/complex

Import symbol

import { pow } from "@babia/complex/math";

Add Package

yarn dlx jsr add @babia/complex

Import symbol

import { pow } from "@babia/complex/math";

Add Package

pnpm dlx jsr add @babia/complex

Import symbol

import { pow } from "@babia/complex/math";

Add Package

bunx jsr add @babia/complex

Import symbol

import { pow } from "@babia/complex/math";