File:Gaussian wavepacket p0=0.webm
Gaussian_wavepacket_p0=0.webm (file size: 998 KB, MIME type: video/webm)
This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.
Summary
| DescriptionGaussian wavepacket p0=0.webm |
English: ```python
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D
a = 1.0 hbar = 1.0 m = 1.0 p0 = 0 xmax = 10 ymax = 0.8 zmax = ymax x = np.linspace(-xmax,xmax, 400) def psi(x, t): r = x denominator = a + 1j * hbar * t / m psi_val = (a / denominator)**(3/2) * np.exp(-r**2 / (2 * denominator)) * np.exp(1j * r * p0) return psi_val tmax = 10 frames_per_t = 12 t_values = np.linspace(-tmax, tmax, frames_per_t * (tmax * 2)) import os movie_name = "gaussian_wavepacket" dir_path = f"./{movie_name}" for N, t in enumerate(t_values): fig = plt.figure(figsize=(20, 20)) ax = fig.add_subplot(111, projection='3d') # ax.set_axis_off() Z = psi(x, t)
ax.plot(x, Z.real, Z.imag, label=f't = {t}', linewidth=4)
ax.set_xlim(-xmax, xmax)
ax.set_ylim(-ymax, ymax)
ax.set_zlim(-zmax, zmax)
if not os.path.exists(dir_path):
os.makedirs(dir_path)
plt.savefig(f"{dir_path}/{N:03d}.png",bbox_inches='tight')
plt.close() import imageio.v3 as iio from natsort import natsorted import moviepy.editor as mp for dir_path in [dir_path]: file_names = natsorted((fn for fn in os.listdir(dir_path) if fn.endswith('.png')))
# Create a list of image files and set the frame rate images = [] fps = 24 # Iterate over the file names and append the images to the list
for file_name in file_names:
file_path = os.path.join(dir_path, file_name)
images.append(iio.imread(file_path))
filename = dir_path[2:] clip = mp.ImageSequenceClip(images, fps=fps) clip.write_videofile(f"output.mp4")
|
| Date | |
| Source | Own work |
| Author | Cosmia Nebula |
Licensing
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Captions
Items portrayed in this file
depicts
some value
28 August 2024
video/webm
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Dimensions | User | Comment | |
|---|---|---|---|---|
| current | 23:13, 30 August 2024 | (998 KB) | wikimediacommons>Cosmia Nebula | Uploaded while editing "Wave packet" on en.wikipedia.org |
File usage
The following page uses this file: