# jsqubits runner

## An online quantum computer simulator

This is a JavaScript runner preloaded with the jsqubits library. Enter arbitrary JavaScript in the text area below and press the "Run" button. For more information, see the jsqubits user manual.

### jsqubits methods

jsqubits(bitstring)
Create a QState object
new QState(numbits, amplitudes)
Create a QState object
subtract(otherState)
Subtract another state
multiply(value)
Multiply by a global phase
normalize()
Normalize the amplitudes
x(targetBits)
Pauli X
y(targetBits)
Pauli Y
z(targetBits)
Pauli Z
r(targetBits, angle)
Phase shift gate
s(targetBits)
Phase gate: r(π/2)
t(targetBits)
T gate: r(π/4)
not(targetBits)
Not
swap(bit1, bit2)
Swap two bits
rotateX(targetBits, angle)
rotateY(targetBits, angle)
rotateZ(targetBits, angle)
cnot(controlBits, targetBits)
Controlled Not
controlledX(controlBits, targetBits)
Controlled Pauli X
controlledXRotation(ctrlBits, trgtBits, angle)
toffoli(controlBit, controlBit, ..., targetBit)
Toffoli
applyFunction(inputBits, targetBits, function)
Apply a function
tensorProduct(otherQState)
Tensor product
qft(targetBits)
Quantum Fourier Transform
amplitude(basisState)
Get an amplitude
measure(targetBits)
Make a measurement
jsqubits.complex(real, imaginary)
Create a complex number
• Most of the bit specifiers can be single numbers (0 being least significant), arrays of numbers, bit ranges (e.g. `{from: 5, to:15}`, or the constant `jsqubits.ALL`. Curently, the exception to this is `applyFunction` as this cannot take arrays. Also, while the `controlledSwap` method is able to take the various types of bit specifiers as control bits, it (and the swap) operator can only take single numbers for the two bits to be swapped.