# Questions tagged [complex-numbers]

This challenge involves the manipulation of complex numbers, including parsing and printing them as well as performing complex arithmetic. This tag also encompasses generalised complex numbers like quaternions.

35 questions
Filter by
Sorted by
Tagged with
320 views

### Greatest Common Gaussian Divisor

Gaussian integers are complex numbers $x+yi$ such that $x$ and $y$ are both integers, and $i^2 = -1$. The norm of a Gaussian integer $N(x+yi)$ is defined as $x^2 + y^2 = |x+yi|^2$. It is ...
2k views

### Simplify ijk-string

Related: Multiply Quaternions Challenge Given a string made of ijk, interpret it as the product of imaginary units of quaternion and simplify it into one of the ...
2k views

### Floor of complex number

Background Complex floor is a domain extension of the mathematical floor function for complex numbers. This is used in some APL languages to implement floor , ...
3k views

### Complex Fibonacci numbers

The Binet formula is a closed form expression for the $n$'th Fibonacci number: $$F_n = \frac {\phi^n - (1-\phi)^n} {\sqrt 5}$$ where $\phi = \frac {1 + \sqrt 5} 2$ is the golden ratio. This ...
305 views

### Counting shortest paths on a triangular grid

Background An Eisenstein integer is a complex number of the form $z = a + b\omega$ where $a, b$ are integers and $\omega$ is the third root of unity $\frac{1-\sqrt3i}{2}$. The Eisenstein ...
218 views

522 views

### Counting Eisenstein primes

Introduction Eisenstein integers are complex numbers of the form a+bω Where a,b are integers, and ...
2k views

### Parse a Quaternion

If you don't know already, a quaternion is basically a 4-part number. For the purposes of this challenge, it has a real component and three imaginary components. The imaginary components are ...
4k views

Gaussian integers are complex numbers of the form a+bi where a and b are both integers. In ...
2k views

### Evaluate the Riemann Zeta Function at a Complex Number

Introduction I found this question that was closed because it was unclear, yet it was a nice idea. I'll do my best to make this into a clear challenge. The Riemann Zeta function is a special function ...
519 views

### Primitive Roots of Unity

Let z be a complex number. z is an nth primitive root of unity if for a certain positive integer ...
584 views

### Output quater-imaginary base numbers in binary

Write a function or program that outputs Quater-imaginary base displayed as binary digits. The number base is 2i, where i is the square root of -1. See Complex Number for more details on i. Each digit ...
415 views

### Add and multiply perplexing numbers

The split-complex numbers, also known as "perplex numbers" are similar to the complex numbers. Instead of i^2 = -1, however, we have ...
957 views

### What's the voltage over each component?

The picture below shows a RLC circuit. A RLC circuit is an electrical circuit consisting of a resistor (R), an inductor (L), and a capacitor (C), connected in series or in parallel. (1) In order to ...
569 views

### Multiply Pauli Matrices

The Pauli matrices are a set of 2x2 matrices which appear very commonly in quantum physics (no, you don't need to know any quantum physics for this challenge). If we include the identity in the set, ...
1k views

### Solve a 2x2 Eigensystem

For those with a little linear algebra background, the challenge is as simple as this: determine the eigenvalues and eigenvectors of a given complex 2x2 matrix. You may skip ahead to The Challenge for ...
2k views

### Wait, but what's e^N?

Objective: The objective is to calculate e^N for some real or imaginary N (e.g. 2, -3i, 0.7, 2.5i, but not 3+2i). This is code golf, so, shortest code (in bytes) wins. So, for example: N = 3, e^N =...
5k views

### Find i^n, given n

The Challenge In as few characters as possible, find the value of $i^n$, given $n$, a positive integer greater than 0. This should be outputted as a String. For those that don't know, $i$ is ...
2k views

### Multiply Quaternions

Write a named function or program that computes the quaternion product of two quaternions. Use as few bytes as possible. Quaternions Quaternions are an extension of the real numbers that further ...
2k views

### is_gaussian_prime(z)?

Task Write a function that accepts two integers $a,b$ that represent the Gaussian integer $z = a+bi$ (complex number). The program must return true or false depending on whether $a+bi$ is a ...
4k views

### Too Fast, Too Fourier: FFT Code Golf

Implement the Fast Fourier Transform in the fewest possible characters. Rules: Shortest solution wins It can be assumed that the input is a 1D array whose length is a power of two. You may use the ...
493 views

### Perform basic operations on complex numbers in a language without native support for complex numbers

Your code has to provide the following functions: read(x) Reads a complex number from the standard input. It has to accept and evaluate something in the form ...