Updated June 2016

This page shows some simple Javascript programs for performing quantum math on 1 and 2-bit polarization states. A 1-bit quantum value is a vector of 2 complex numbers, although for most purposes the first component can be a non-negative real number, since only the phase difference between the two components matters. 1-bit values can be visualized as 2d ellipses, having an orientation (of the major axis), an eccentricity, and a sense of chirality (usually depicted as green or red color). 1-bit values can also be displayed as a point on the surface of a sphere, where the longitude shows the orientation of the ellipse, and the latitude shows the degree of circularity. Operations are performed on 1-bit values using 2x2 matrix multiplication. There are several well-known operators, with names like "Pauli X" and "Hadamard". For use in quantum math, operators are usually either "Hermitian", or "unitary", or both.

2-bit quantum values are vectors (actually matrices) of 4 complex numbers, where again only the phase differences between the various components matters. It is difficult to visualize 2-bit values, although the logical extension from 1-bit values is that of a 4-dimensional ellipse. On the computer screen, only the 2d and 3d cross-sections of this ellipse can be shown. A 2-bit value can be constructed from 2 1-bit values (a "separable" 2-bit value), or the individual components can be set independently so that it cannot be represented as the combination of 2 1-bit values (a "non-separable" 2-bit value). Almost all 2-bit values are of the latter kind (e.g. random values). This property makes multi-bit quantum computing very different than conventional computing. However, this distinction (separable/non-separable) is not necessarily a binary one, and many 2-bit values can be decomposed into a best-fit combination of 1-bit values. There are also 2-bit states called the Bell states that are maximally non-separable (also called "entangled") such that there is no preferred nearby combination of 1-bit values that approximate them. Operations are performed on 2-bit values using 4x4 matrix multiplication. There are several well-known operators, with names like "c-not". Again, 2-bit operators are usually either Hermitian, unitary, or both, the combination of the two being especially important.

Javascript programs:These programs have been tested only with Chrome/Chromium and Firefox on Linux (Ubuntu 14.04) and the Mac (10.13.5).

- polar_xygrid.html : Javascript program displaying a grid of polarization ellipses. This grid shows combinations of the x and y magnitudes of ellipses which range from 0.0 to 1.0. Each ellipse (where present) is normalized to have a magnitude of 1.0. The x and y phases are set from the sliders at right, although it is only the difference in phase that matters (i.e. you can leave the x phase at 0.0 and just move the y slider). By changing the phase, and scrolling the window, you can see examples of all types of 1-bit polarization: "green" circular and elliptical, linear, and "red" circular and elliptical. The angles displayed in each plot are psi (the orientation of the major axis of the ellipse) and chi (an indication of the circularity).
- polar_1bit.html : Javascript program for creating 1-bit polarization states. Here you can play with a single bit by setting the magnitudes and phases of each complex component independently with sliders. The normalized 1-bit value is displayed both as a 2d ellipse and as a point on the computational sphere (sometimes called the Poincare or Bloch sphere). Initially, the display shows the D (diagonal) state made from equal contributions of the H (horizontal) and V (vertical) basis. Change the phase of either component to rotate the state about the HV axis (or the currently chosen basis axis). Change the magnitudes to move the state closer to H or to V (or the currently chosen basis states). Click the 'G', 'A', 'V', 'H', 'D', 'R' buttons to get specific states on the sphere. Click the H/V, D/A, or G/R buttons to set the basis (the eigenstates applied to the slider settings). Drag the sphere to rotate it. Click the '+' button to start tracing a new curve when you move the sliders. Click '=' to end the current curve. Click 'C' to clear all curves. Click 'G' to toggle the grid display.
- polar_addition.html : Javascript program for adding two 1-bit polarization states. This program allows you to add two 1-bit states together, forming another 1-bit state. Set the two addends at upper and lower left as in the previous example (the H/V basis is used). Set the complex coefficients of each addend (A and B) with the middle sliders. The normalized sum is displayed at right. For example, the result of adding the H and V states is the D state. You can see how the different bases work by, for example, setting the first addend to G and the second to R (the circular basis). Then, changing the phase difference between the A and B coefficients changes the orientation of the resulting ellipse, while changing the relative magnitudes of A and B make the resulting curve more or less elliptical. This kind of direct control of orientation and ellipticity of polarization is mathematically and physically simpler in the circular basis, and more difficult in any linear basis (e.g. H/V or D/A), so the circularly polarized states are important for quantum computing.
- polar_1bitop.html : Javascript program performing operations on 1-bit polarization states. 1-bit operations are performed as 2x2 matrix multiplication (with one exception mentioned below). Set the 1-bit input state with the sliders and buttons at left. You can set the 4 complex coefficients of the matrix directly with the center sliders, or select one of the pre-programmed operators from the pop-up menu at center bottom. The result of the operation is displayed at right. The program is initialized with the identity matrix loaded, so, for example, by moving the "a11 phase" slider you can create different phase gates. Indicators at lower center show if the current matrix is Hermitian or unitary. The u-not operation is included as an example of a 1-bit operation that is not representable as a 2x2 matrix, and is therefore not a "legal" quantum operation, although the procedure for calculating the orthonormal compliment of the input state is quite simple. Whether a true u-not can be implemented as a 2-bit operation, or physically as simple (but potentially non-linear and/or non-unitary) optics are important questions in this project.
- polar_2bit_product.html : Javascript program for creating 2-bit polarization states from two 1-bit states. Enter the two input states with the sliders and buttons at left. The resulting 2-bit state is the outer product of the input states and is displayed as a 2x2 grid of complex values at center. The complex values of the 2 input states are shown to the left and at top. The 2-bit state is shown as 2d and 3d cross-sections of a normalized 4d ellipse in the plots at right. Note how the wy and wz plots follow the first input, the wx and yz plots follow the second input (conjugated), and that when the two inputs are orthogonal (as when the page is reloaded) the wz plot is always linear. This is work in progress.
- polar_2bit_general.html : Javascript program for creating general 2-bit polarization states. Enter the values of the 4 complex coefficients of the 2-bit value using the sliders at left, or choose one of the pre-programmed states from the pop-up menu at lower left. The 2-bit state is displayed as a 2x2 grid of complex values at center. If the state is separable, an indicator shows below the sliders, and the complex values of the 2 input states are shown to the left and top of center. 1-bit polarization ellipses and spheres are shown at far right. The 2-bit state is shown as 2d and 3d cross-sections of a normalized 4d ellipse in the plots at near right. Some combinations of basis states (e.g. Bell) can be chosen from the menu. The separability of a 2-bit state isn't really a binary thing, but should show the best-fit pair of candidates, with decreasing confidence as the state approaches the Bell states. This is work in progress.
- polar_2bitop.html : Javascript program performing operations on 2-bit polarization states. This is preliminary work. Enter the separable 2-bit state as 2 1-bit inputs at left, and the 4x4 matrix operator using the sliders at center, or choose one of the pre-programmed operators from the menu. Currently, the input and result are displayed as 2x2 complex coefficients at right. This needs to have sliders for setting general 2-bit states, and additional displays for 2-bit and separable results. Note how the Hadamard operator interconverts states consisting of single basis vectors and equal combinations of all basis vectors, and the c-not operator interconverts separable (e.g. {D, H}) and non-separable states by swapping the last two (bottom row) coefficients.

©Copyright Sky Coyote, 2015-2016.