-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayground.py
More file actions
58 lines (42 loc) · 1.33 KB
/
Copy pathplayground.py
File metadata and controls
58 lines (42 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 15 01:17:48 2021
@author: non_k
"""
#%%
import Quantum as Q
import matplotlib.image as im
N = 255 # upper bound on image linear dimension. can change.
img = Q.colour_drain(im.imread('lenna.jpg')) # input the image name here
if min((len(img), len(img[0]))) > N:
img = Q.contract(img, N)
h = Q.Hamiltonian(img, gen = 30)
print('%s unperturbed eigenstates with distinct energies were generated \
initially' % (h.size()))
#%%
'''
display the energies of chosen eigenstates as a function of the lambda
parameter.
'''
h.energy_split([150, 151, 152])
#%%
'''
display a perturbed wavefunction squared associated with the
'''
h.display_u(177)
#%%
'''
display a linear superposition of perturbed wavefunctions and the
subsequent time evolution.
'''
h.superpose([0, 50, 100, 150, 200], np.ones(5))
#%%
'''
decompose the image on the perturbed wavefunctions.
assigning animate = True will result in the time evolution being shown as
well, but the execution time will be much longer.
recommend saving the animation so you will not miss it once the execution
finished
'''
h.replicate(num = 150, animate = False)
#h.replicate(num = 150, animate = True, saving = (True, 'lenna.mp4'))