Quantum Calculator with Dirac Notation

To calculate, enter something in Dirac notation (using ket or bra vectors) and press tab or click outside the input box. The labels of vectors must be binary numbers. You can use your browser's back button to go back to earlier calculations. Enjoy!

Example: cos(pi/6)|010> + i|001>



normalize ket and bra vectors (but not scalars or operators)


Dirac.js Library

This is a demonstration of using the dirac.js library. It provides a dirac() object that allows you to chain operations such as appending .ket(..) or .bra(..) vectors. Or you can just simply use its parsing and formatting capabilities, on which this example exclusively depends.

To get started with using diracjs, I recommend using your browser's console. You may want to try replicating this webpage's functionality:


	  dirac('|0>').toString()
	  dirac('cos(pi/6)|010> + i|001>').normalize().toString()
      
In code, you can assert that ket and bra vectors are really what you think they are:

	var ketVector = dirac('|0>'),
	    braVector = dirac('<0|'),
	    operator = dirac().ket(ketVector).bra(braVector);
	console.log(operator.toString());
      

Unit Tests

There are unit tests you may wish to run in your browser if you think of using and trusting diracjs.