This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Factorization of Gaussian integers

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.




numlib::factorGaussInt(n) returns the factorization of the Gaussian integer n into Gaussian primes. Among associate primes, that one with smallest polar angle is chosen.


Example 1

In the Gaussian integers, 3 remains prime while 5 does not:

numlib::factorGaussInt(3), numlib::factorGaussInt(5)

Example 2

The argument to numlib::factorGaussInt may be any Gaussian integer, that is, every complex number of the form a + b i where a and b are integers:




An integer, or a complex number whose real and imaginary part are integers

Return Values

numlib::factorGaussInt returns a list [u, p1, a1, ..., pk, ak] where u is a unit in the Gaussian integers, the pi are Gaussian primes and the ai are positive integers, such that .


The function ifactor is used to factor the norm; this step takes most of the running time. Hence, the running time of the algorithm mainly depends on the size of the prime factors of the norm of n.

See Also

MuPAD Functions

Was this topic helpful?