Skip to content

Commit adc501d

Browse files
committed
Removed wigner, Qd and TwoMode
Examples for removed material are already in visualization-exposition.md
1 parent 40bcc51 commit adc501d

File tree

1 file changed

+10
-73
lines changed

1 file changed

+10
-73
lines changed

tutorials-v5/visualization/distributions.md

Lines changed: 10 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -18,89 +18,25 @@ Author: Mathis Beaudoin (2025)
1818

1919
### Introduction
2020

21-
This notebook shows how to use the different types of probability distributions inside qutip.
22-
23-
We begin by importing the necessary packages.
21+
This notebook shows how to use probability distributions inside QuTiP. We begin by importing the necessary packages.
2422

2523
```python
26-
from qutip import *
27-
from qutip.distributions import *
24+
from qutip import fock
25+
from qutip.distributions import HarmonicOscillatorWaveFunction, HarmonicOscillatorProbabilityFunction
2826
import matplotlib.pyplot as plt
2927
```
30-
31-
Then we define some quantum state.
32-
33-
```python
34-
N = 20
35-
alpha = 2.0 + 2j
36-
rho = (coherent(N, alpha) + coherent(N, -alpha)).unit()
37-
```
38-
39-
### Wigner Distribution
40-
41-
To use the Wigner distribution, simply use the `WignerDistribution` class and pass a quantum state to the constructor. Optionally, define a range of values for each coordinate with the parameter called `extent`. Also, define a number of data points inside the given range with the optional parameter called `steps`. From this information, the distribution is generated and can be visualized with the `visualize` method.
42-
43-
```python
44-
#Generate the wigner distribution
45-
wigner = WignerDistribution(rho, extent=[[-10, 10], [-10, 10]], steps=300)
46-
wigner.visualize()
47-
```
48-
49-
It is also possible to calculate the marginal and projection distribution along a given dimension. These methods are available for the other distributions below as well.
50-
51-
```python
52-
alpha = 2.0
53-
N = 20
54-
rho = (coherent(N, alpha) + coherent(N, -alpha)).unit()
55-
wigner = WignerDistribution(rho)
56-
wigner.visualize()
57-
58-
#x axis
59-
wigner_x = wigner.marginal(dim=0)
60-
wigner_x.visualize()
61-
62-
#y axis
63-
wigner_y = wigner.marginal(dim=1)
64-
wigner_y.visualize()
65-
66-
#projection
67-
proj = wigner.project(dim=1)
68-
proj.visualize()
69-
```
7028

71-
### Husimi-Q Distribution
72-
73-
To use the Husimi-Q distribution, simply use the `QDistribution` class and pass it a quantum state. Again, `extent` and `steps` are optional parameters for this distribution.
74-
75-
```python
76-
hq = QDistribution(rho, extent=[[-10, 10], [-10, 10]], steps=300)
77-
hq.visualize()
78-
```
79-
80-
### Two-mode quadrature correlations
81-
We start with a new quantum state.
82-
83-
```python
84-
alpha = 1.0
85-
psi = (tensor(coherent(N, alpha), basis(N, 0)) + tensor(basis(N, 0), coherent(N, -alpha))).unit()
86-
rho = (ket2dm(tensor(coherent(N, alpha), basis(N, 0))) + ket2dm(tensor(basis(N, 0), coherent(N, -alpha)))).unit()
87-
```
88-
89-
In this case, we use the `TwoModeQuadratureCorrelation` class.
29+
### Harmonic Oscillator Wave Function
9030

91-
```python
92-
two_mode_psi = TwoModeQuadratureCorrelation(psi)
93-
two_mode_psi.visualize()
31+
Here, we display the spatial distribution of the wave function for the harmonic oscillator (n=0 to n=7) with the `HarmonicOscillatorWaveFunction()` class.
9432

95-
two_mode_rho = TwoModeQuadratureCorrelation(rho)
96-
two_mode_rho.visualize()
97-
```
33+
Optionally, define a range of values for each coordinate with the parameter called `extent`. Also, define a number of data points inside the given range with the optional parameter called `steps`. From this information, the distribution is generated and can be visualized with the `.visualize()` method.
9834

99-
### Harmonic Oscillator Wave Function
100-
Here, we display the spatial distribution of the wave function for the harmonic oscillator (n=0 to n=7) with the `HarmonicOscillatorWaveFunction` class.
35+
It is also possible to calculate, along a given axis, the marginal distribution with `.marginal()` or the projection distribution with `.project()`.
10136

10237
```python
10338
M=8
39+
N=20
10440

10541
fig, ax = plt.subplots(M, 1, figsize=(10, 12), sharex=True)
10642

@@ -112,10 +48,11 @@ for n in range(M):
11248

11349
### Harmonic Oscillator Probability Function
11450

115-
The class `HarmonicOscillatorProbabilityFunction` is the squared magnitude of the data that would normally be in `HarmonicOscillatorWaveFunction`. We use the same example as before.
51+
The class `HarmonicOscillatorProbabilityFunction()` is the squared magnitude of the data that would normally be in `HarmonicOscillatorWaveFunction()`. We use the same example as before.
11652

11753
```python
11854
M=8
55+
N=20
11956

12057
fig, ax = plt.subplots(M, 1, figsize=(10, 12), sharex=True)
12158

0 commit comments

Comments
 (0)