Skip to content

Commit 7b44c2b

Browse files
Added commutation example
- added examples that commutation is no preserved - v5 test more concise
1 parent 5d9271c commit 7b44c2b

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

tutorials-v4/miscellaneous/excitation-number-restricted-states-jc-chain.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ psi0 = tensor(
162162
)
163163
```
164164

165+
Regular operators of different systems commute as they belong to different Hilbert spaces.
166+
Example:
167+
168+
```python
169+
d[0].dag() * d[1] == d[1] * d[0].dag()
170+
```
171+
172+
Solving the time evolution:
173+
165174
```python
166175
%time res1, H1, L1 = solve(d, psi0)
167176
```
@@ -173,6 +182,15 @@ d = enr_destroy(dims, excite)
173182
psi0 = enr_fock(dims, excite, [init_excite if n == 1 else 0 for n in range(2 * N)])
174183
```
175184

185+
Using ENR states forces us to give up on the standard tensor structure of multiple Hilbert spaces.
186+
Operators for different systems therefore generally no longer commute:
187+
188+
```python
189+
d[0].dag() * d[1] == d[1] * d[0].dag()
190+
```
191+
192+
Solving the time evolution:
193+
176194
```python
177195
%time res2, H2, L2 = solve(d, psi0)
178196
```

tutorials-v5/miscellaneous/excitation-number-restricted-states-jc-chain.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ psi0 = tensor(
161161
)
162162
```
163163

164+
Regular operators of different systems commute as they belong to different Hilbert spaces.
165+
Example:
166+
167+
```python
168+
d[0].dag() * d[1] == d[1] * d[0].dag()
169+
```
170+
171+
Solving the time evolution:
172+
164173
```python
165174
%time res1, H1, L1 = solve(d, psi0)
166175
```
@@ -172,6 +181,15 @@ d = enr_destroy(dims, excite)
172181
psi0 = enr_fock(dims, excite, [init_excite if n == 1 else 0 for n in range(2 * N)])
173182
```
174183

184+
Using ENR states forces us to give up on the standard tensor structure of multiple Hilbert spaces.
185+
Operators for different systems therefore generally no longer commute:
186+
187+
```python
188+
d[0].dag() * d[1] == d[1] * d[0].dag()
189+
```
190+
191+
Solving the time evolution:
192+
175193
```python
176194
%time res2, H2, L2 = solve(d, psi0)
177195
```
@@ -256,7 +274,7 @@ about()
256274

257275
```python
258276
assert np.allclose(
259-
res1.states[10].ptrace([1]).data.to_array(),
260-
ENR_ptrace(res2.states[10], [1], excite).data.to_array(),
277+
res1.states[10].ptrace([1]).full(),
278+
ENR_ptrace(res2.states[10], [1], excite).full(),
261279
), "The approaches do not yield the same result."
262280
```

0 commit comments

Comments
 (0)