In each of the examples you mentioned, the task breaks very roughly down into two steps: finding a Hamiltonian that describes the problem in terms of qubits, and finding the ground state energy of ...

Effectively, the Z operation (represented by the Pauli $Z$ matrix) applies a rotation about the $Z$-axis. As you note, rotations can also be written in the form $e^{-i Z t}$. To see that, you can use ...

Just as with classical computing, we don't expect that in quantum computing the choice of a programming language will have a direct effect on the time and space complexity of most algorithms. That is, ...

Thanks for your question! If you're interested in running multiple shots of a quantum operation, Q# allow for doing that with conventional programming techniques such as a for loop: open Microsoft....

In the case that your operation can be represented by a unitary operator $U$ (this is typically the case if your operation doesn't use any measurements), you can indicate that by adding is Adj to your ...

In general, there are exactly two ways to allocate qubits in Q#: the using statement, and the borrowing statement. Both can only be used from within Q#, and can't be directly used from within C#. Thus,...

Since the S operation supports the Adjoint functor, the Q# call Adjoint S(target) is the easiest way to call the $S^{\dagger}$ gate. To verify that this is the same as the suggestion made above by ...

It can be helpful to step back and look at what a density matrix describes: a probability distribution over projectors onto pure states. In your example, for instance, $\rho$ represents a distribution ...

This is easiest to show by contradiction, so lets suppose that there exists an operation TransformToOrthogonal that maps the state of its input qubits to an orthogonal state. Reversible quantum ...

I believe that Heroku does not currently support installing additional software, such as the IQ# kernel used by the qsharp Python package. That said, Heroku's documentation suggests that using Docker ...

Quantum programs in Q# can include classical logic as well as low-level quantum instructions, such that you can directly include the "shot" concept from circuits in your Q# programs by using ...

As @JSdJ indicated in their comment, one approach is to perform the assertion in the 𝑋-basis instead of the 𝑍-basis: open Microsoft.Quantum.Diagnostics; @Test("QuantumSimulator") ...

The unit test logic is correct, no worries there! One of the really neat things about the four Bell states is that you can transform between each using single-qubit operations. For example, consider ...

One problem is that you are resetting the $\left|z\right\rangle$ register after applying the Controlled X(z, y) operation. Right before you reset, your $\left|z\right\rangle$ register is entangled ...

The trick here is to define a new operation whose unitary representation is \begin{align} S_a|i\rangle = \begin{cases} -|i\rangle \text{ if } i = a \\ |i\rangle \text{ otherwise } ...

One important thing to note is that arrays of Qubit aren't special in Q#, such that a solution that allows for splitting an array of type 'T[] into 'T[][][] will also work for arrays of qubits such as ...

The subscripting operator ([]) in Q# only works on values of array types, such as Int[], Qubit[] or Double[][]. To unpack a tuple, you can deconstruct when you assign the tuple in a let statement or ...

There's a feature request for a Q# operation to apply an arbitrary unitary operation given its representation as a matrix; if you're interested, please go on and leave a comment on that request! In ...

The key to figuring out the probability of any measurement result is Born's rule, which says that if you have a state $\left|\psi\right\rangle$ the probability of observing measurement outcome \$\left|\...