ts-quantum
Version:
TypeScript library for quantum mechanics calculations and utilities
70 lines (69 loc) • 2.08 kB
TypeScript
/**
* Math utilities for quantum operations
*/
import { Complex } from '../core/types';
/**
* Computes log(n!) avoiding overflow using summation of logs
* Uses caching for efficiency
*
* @param n Input number (must be non-negative integer)
* @returns log(n!)
*/
export declare function logFactorial(n: number): number;
/**
* Computes n! using cached log factorial
*
* @param n Input number (must be non-negative integer)
* @returns n!
*/
export declare function factorial(n: number): number;
/**
* Computes double factorial n!! = n * (n-2) * (n-4) * ...
* Uses caching for efficiency
*
* @param n Input number (must be non-negative integer)
* @returns n!!
*/
export declare function doubleFactorial(n: number): number;
/**
* Computes Legendre polynomial P_n(x) using recursion
*
* @param n Degree of polynomial (must be non-negative integer)
* @param x Argument (-1 <= x <= 1)
* @returns P_n(x)
*/
/**
* Calculates triangle coefficient for three angular momenta
* Delta(a,b,c) = sqrt((a+b-c)!(a-b+c)!(-a+b+c)!/(a+b+c+1)!)
*
* @param a First angular momentum
* @param b Second angular momentum
* @param c Third angular momentum
* @returns Triangle coefficient
*/
export declare function triangleCoefficient(a: number, b: number, c: number): number;
/**
* Computes Legendre polynomial P_n(x) using recursion
*
* @param n Degree of polynomial (must be non-negative integer)
* @param x Argument (-1 <= x <= 1)
* @returns P_n(x)
*/
export declare function legendrePolynomial(n: number, x: number): number;
/**
* Computes matrix exponential using Taylor series
*/
export declare function matrixExponential(matrix: Complex[][], terms?: number): Complex[][];
/**
* Multiplies two complex matrices
*/
export declare function multiplyMatrices(a: Complex[][], b: Complex[][]): Complex[][];
/**
* Computes the singular value decomposition of a matrix
* Note: This is a placeholder for a proper SVD implementation
*/
export declare function singularValueDecomposition(matrix: Complex[][]): {
U: Complex[][];
S: number[];
V: Complex[][];
};