<jupyter_start><jupyter_text>Plotting Particle Displacement In Sound Fields[back to overview page](index.ipynb) The following is based on this Mathematica notebook: http://library.wolfram.com/infocenter/MathSource/780/<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
particles = 1000
length = 2  # along x-axis
width = 0.2  # along y-axis
wavelength = 0.3 * length
amplitude = 0.1 * wavelength
t = 0  # TODO: animation from 0 to 1
x = np.random.uniform(0, length, particles)
y = np.random.uniform(0, width, particles)
x += amplitude * np.sin((2 * np.pi / wavelength) * x - 2 * np.pi * t)
fig, ax = plt.subplots(figsize=(12, 1))
ax.scatter(x, y)
ax.axis('equal')
ax.axis('tight');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13379310344827586, 'fraction_numerical': 0.03310344827586207, 'mean_word_length': 4.716535433070866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '68580', 'license': 'CC0-1.0', 'n_tokens_mistral': 281, 'n_tokens_neox': 260, 'n_words': 74, 'path': 'plotting/particle-displacement.ipynb', 'repo_name': 'mgeier/python-audio', 'size': '725'}