{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Waves\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Waves are ubiquitous, being found nearly everywhere we look in nature. There are many kinds: mechanical (waves in water, sound, vibrating strings), electromagnetic (light is wave!), and the wavelike nature of all particles according to quantum mechanics. Despite this variety, just a few mathematical equations can describe a great deal of wave phenomena. If you have a solid understanding of the sine function, you're off to a good start. Most of the trickiness is in notation, which I'll try to clear up here. If you start to get bored, there's a bit of music theory at the end."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Index\n",
"\n",
"1. [Sine waves](#wave)\n",
"2. [Traveling waves](#traveling)\n",
"3. [Listening to waves](#sound)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Sine waves"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A general wave definition is something like \"a propagating disturbance\". For example, think of the ripples when you throw a rock into a pond. Waves are typically described by the thing that's changing (the height of water) and the medium in which the wave exists/moves (the pond water). Waves can be both spatial and temporal. That is, the ripple pattern exists over some distance or region of the pond, and it is also changing in time. **Don't think of the wave as water physically moving from one place to another within the pond.** Rather, we are describing the height of water in the pond using a function of location and time—and the function happens to be a wave.\n",
"\n",
"Other wave examples (variable / medium):\n",
"- ripples in pond (height of water / pond water)\n",
"- sound (air pressure / air)\n",
"- vibrating guitar/piano string (displacement from equilibrium / the string)\n",
"- light (electric & magnetic field values / magic)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"Image of wave [from wikibooks](https://en.wikibooks.org/wiki/Physics_Study_Guide/Waves)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Above is a picture of a typical sine wave. Not all waves are perfectly sinusoidal, but these are convenient to analyze. (Others include square, triangle, and sawtooth waves.)\n",
"\n",
"Using the pond example again, the height of water is called the *displacement* and is measured with respect to some equilibrium value—what the height would be with still water and no disturbance. The displacement can take on both positive and negative values, oscillating about this equilibrium value (which is almost always chosen to be 0). The distance between two similar points on the wave shape (e.g. peak to peak, shown in the image) is called the wavelength, $\\lambda$.\n",
"\n",
"Let's say we want to actually write down a sine function to describe the ripple pattern in the water (we're just taking a snapshot in time right now). Technically, we're also going to limit ourself to one dependent variable $x$, even though pond surface exists in 2 dimensions. We might start with something like:\n",
"\n",
"$$ \\text{height} = y = \\sin x $$\n",
"\n",
"We know the sine function repeats itself every $2 \\pi$ units, and we said the distance between two similar points is $\\lambda$. So, when $x$ changes by $\\lambda$, we want our function to return the same value. Let's try this:\n",
"\n",
"$$ y = \\sin \\Big(\\frac{2 \\pi x}{\\lambda}\\Big)$$\n",
"\n",
"Check that this function works, and also note that dimensional analysis requires something of this form. Special functions like sine, cosine, exponential, etc. require a *dimensionless* expression within the function. Our dependent variable $x$ has dimensions of length, so we must divide by something else with dimensions of length ($\\lambda$)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally, we might want to compare two waves with the same wavelength, but one is shifted relative to another. Lucky for us, the sine function slides to the left/right when you add positive/negative values to the function's expression. We call this the *phase shift* $\\phi$:\n",
"\n",
"$$ y = \\sin \\Big(\\frac{2 \\pi x}{\\lambda} + \\phi \\Big)$$\n",
"\n",
"In other words, we might not always want $y = 0$ at $x = 0$, so we can choose the appropriate location for $y = 0$ by adjusting $\\phi$."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3d98f151d67745a5bbe785849d134d8e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(FigureWidget({\n",
" 'data': [{'mode': 'lines',\n",
" 'name': 'lines',\n",
" 'typ…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import plotly.graph_objs as go\n",
"from ipywidgets import interactive, HBox, VBox, widgets, interact\n",
"import numpy as np\n",
"\n",
"xs = np.linspace(0, 5, 1000)\n",
"\n",
"def wave(lam, phi, x):\n",
" \n",
" return np.sin(2*np.pi*x/lam + phi)\n",
"\n",
"fig = go.FigureWidget()\n",
"\n",
"fig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n",
"\n",
"fig.update_layout(\n",
" title={\n",
" 'text': r'$y = \\sin \\Big(\\frac{2 \\pi x}{\\lambda} + \\phi \\Big)$',\n",
" 'y':0.85,\n",
" 'x':0.5,\n",
" 'xanchor': 'center',\n",
" 'yanchor': 'top'})\n",
"\n",
"fig.update_xaxes(\n",
" title_text = r\"$x$\",\n",
" title_standoff = 15,\n",
" ticks = 'outside',\n",
" ticklen = 10,\n",
" tickcolor='white')\n",
"\n",
"fig.update_yaxes(\n",
" title_text = '',\n",
" title_standoff = 25,\n",
" ticks = 'outside',\n",
" ticklen = 10,\n",
" tickcolor = 'white')\n",
"\n",
"\n",
"line = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n",
" mode='lines',\n",
" name='lines'))\n",
"\n",
"slider = widgets.FloatSlider(\n",
" value = 1,\n",
" min=0.1,\n",
" max=10,\n",
" step=0.1,\n",
" readout=True,\n",
" description=r'$\\lambda$')\n",
"slider.layout.width = '400px'\n",
"\n",
"slider2 = widgets.FloatSlider(\n",
" value = 0,\n",
" min=-3.14,\n",
" max=3.14,\n",
" step=0.01,\n",
" readout=True,\n",
" description=r'$\\phi$')\n",
"slider2.layout.width = '400px'\n",
"\n",
"def update_range(lam, phi):\n",
" fig.data[0].y=wave(lam, phi, xs)\n",
"\n",
"vb = VBox((fig, interactive(update_range, lam = slider, phi = slider2)))\n",
"vb.layout.align_items = 'center'\n",
"vb"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Traveling waves\n",
"\n",
"What if we want to also describe how the ripples in the ponds change over time? First, we should consider a duck floating at a specific point on the pond and riding the waves up and down. The height of the duck is a function of time, and notice that it oscillates up and down like a wave. In fact, we can describe the duck's displacement using the sine function again, but with time $t$ as the dependent variable:\n",
"\n",
"$$ \\text{duck height} = y = \\sin (2 \\pi f t)$$.\n",
"\n",
"The $f$ in the sine expression is called the *frequency* of the wave. It is the number of oscillations per second. In the duck animation below, it takes about two seconds from peak to peak (2 seconds each oscillation). That means half an oscillation each second, or $f = 0.5$ Hz. The units, Hertz (Hz), is another way of saying \"per second\" or Hz = $\\frac{1}{s}$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"\n",
"\n",
"Duck animation [from brilliant.org](https://brilliant.org/practice/waves-1/)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, if we want to forget about the duck and describe the water waves as both a function of space and time, we can combine our spatial and temporal sine functions. Remember how a negative phase shift $\\phi$ would move the entire wave shape to the right? What if we use that property of the sine function to our advantage and write:\n",
"\n",
"$$ y = \\sin \\Big(\\frac{2 \\pi x}{\\lambda} - 2 \\pi f t \\Big)$$.\n",
"\n",
"Within this sine function, the left term describes the wave shape over space. As time passes, $t$ increases, and the this wave shape slides to the right with some speed. We call this a *traveling wave*. Most textbooks/physicists will not write this function in terms of wavelength and frequency. Instead, the wavenumber $k$ and angular frequency $\\omega$ are defined:\n",
"\n",
"$$ k = \\frac{2 \\pi}{\\lambda} $$\n",
"\n",
"$$ \\omega = 2 \\pi f $$\n",
"\n",
"Angular frequency is almost like frequency, except it is measuring \"radians per second\" rather than \"oscillations per second\", with an implicit understanding that each oscillation corresponds to $2 \\pi$ radians. Wavenumber is almost like a spatial frequency, which measures \"oscillations per unit of distance\". In physics, the factor of $2 \\pi$ is also included in the definition of wavenumber, so $k$ measures \"radians per unit of distance\". \n",
"\n",
"It can take some time to get used to the notation, so it's good to keep these relations handy while it all sinks in. One more useful thing to remember: the traveling wave moves at a velocity $v$, where\n",
"\n",
"$$ v = \\frac{\\omega}{k}$$.\n",
"\n",
"You can see how wavenumber and angular frequency change a wave in the animation below."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f8b551508ae64698880830fc07860545",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(FigureWidget({\n",
" 'data': [{'mode': 'lines',\n",
" 'name': 'lines',\n",
" 'typ…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"xs2 = np.linspace(0, 5, 500)\n",
"\n",
"def traveling_wave(k, omega, x, t):\n",
" return np.sin(k*x - omega*t/10.)\n",
"\n",
"fig2 = go.FigureWidget()\n",
"\n",
"fig2.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n",
"\n",
"fig2.update_layout(\n",
" title={\n",
" 'text': r'$y = \\sin(kx - \\omega t)$',\n",
" 'y':0.85,\n",
" 'x':0.5,\n",
" 'xanchor': 'center',\n",
" 'yanchor': 'top'})\n",
"\n",
"fig2.update_xaxes(\n",
" title_text = r\"$x$\",\n",
" title_standoff = 15,\n",
" ticks = 'outside',\n",
" ticklen = 10,\n",
" tickcolor='white')\n",
"\n",
"fig2.update_yaxes(\n",
" title_text = '',\n",
" title_standoff = 25,\n",
" ticks = 'outside',\n",
" ticklen = 10,\n",
" tickcolor = 'white')\n",
"\n",
"\n",
"line2 = fig2.add_trace(go.Scatter(x=xs2, y=traveling_wave(1, 0, xs2, 0),\n",
" mode='lines',\n",
" name='lines'))\n",
"\n",
"bslider = widgets.FloatSlider(\n",
" value = 3.14,\n",
" min=0.1,\n",
" max=10,\n",
" step=0.02,\n",
" readout=True,\n",
" description=r'$k$')\n",
"bslider.layout.width = '400px'\n",
"\n",
"bslider2 = widgets.FloatSlider(\n",
" value = 0,\n",
" min=-1,\n",
" max=1,\n",
" step=0.1,\n",
" readout=True,\n",
" description=r'$\\omega$')\n",
"bslider2.layout.width = '400px'\n",
"\n",
"play = widgets.Play(\n",
" interval = 5,\n",
" value = 0,\n",
" min=0,\n",
" max=500,\n",
" step=1\n",
")\n",
"\n",
"def update2(k, omega, time):\n",
" \n",
" fig2.data[0].y=traveling_wave(k, omega, xs2, time)\n",
"\n",
"vb2 = VBox((fig2, interactive(update2, k = bslider, omega = bslider2, time = play)))\n",
"vb2.layout.align_items = 'center'\n",
"vb2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Listening to waves\n",
"\n",
"Sound is also a wave, but a bit different than the water wave example we've been using. Rather than the height of water oscillating up and down, the air pressure fluctuates. On average, the air pressure is constant throughout a room (atmospheric pressure), but it can change locally. When you hit a drum, the drum head oscillates up and down, which in turn compresses air molecules near the head's surface in a cyclical fashion. This compression propagates as a high pressure wave front, and these repeated compression/expansion (high/low pressure) cycles are perceived as sound. This is an example of a *longitudinal wave*.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"\n",
"\n",
"Speaker animation [from NPR](https://www.npr.org/2014/04/09/300563606/what-does-sound-look-like)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When you listen to music, usually a speaker creates the sound by vibrating a speaker head (a thin membrane). The sound waves propagate through the air in the room and cause your ear drum to vibrate with the same pattern—delayed by however long it takes the waves to travel from the speaker to your ear. And to be clear, most sounds aren't just a single sinusoidal wave with one specific frequency. There's usually a mess of many different frequencies, each with their own amplitude and phase, along with other structure in the wave form (not everything that makes a noise is a simple harmonic oscillator).\n",
"\n",
"It would take an entire notebook to describe how *standing waves* and *harmonics* lead to the different sounds of instruments/voices. We could also spend ages discussing how the inner ear and subsequent neural circuitry allows you to interpret sound. For now, let's just play with your ear/brain's perception of two overlapping frequencies. I apologize if you cannot hear the following, and I've included a plot of the audio wave as well."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'np' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mIPython\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdisplay\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mAudio\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mdisplay\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mclear_output\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mxs3\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlinspace\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m0.2\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mf1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mwidgets\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mIntSlider\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmin\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmax\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m600\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstep\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdescription\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m\"frequency 1\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mNameError\u001b[0m: name 'np' is not defined"
]
}
],
"source": [
"from IPython.display import Audio,display, clear_output\n",
"\n",
"xs3 = np.linspace(0, 0.2, 1000)\n",
"\n",
"f1 = widgets.IntSlider(value = 1, min = 1, max = 600, step = 1, description = \"frequency 1\")\n",
"f1.layout.width = '400px'\n",
"f2 = widgets.IntSlider(value = 1, min = 1, max = 600, step = 1, description = \"frequency 2\")\n",
"f2.layout.width = '400px'\n",
"\n",
"button = widgets.Button(description='Play Sound')\n",
"sound_out = widgets.Output()\n",
"fig3 = go.FigureWidget()\n",
"\n",
"fig3.add_trace(go.Scatter(x=xs3, y=np.sin(2*np.pi*1*xs3) + np.sin(2*np.pi*1*xs),\n",
" mode='lines',\n",
" name='sum'))\n",
"fig3.add_trace(go.Scatter(x = xs3, y = np.sin(2*np.pi*80*xs3), mode = \"lines\", opacity = 0.2, name = \"frequency 1\"))\n",
"fig3.add_trace(go.Scatter(x = xs3, y = np.sin(2*np.pi*80*xs3), mode = \"lines\", opacity = 0.2, name = \"frequency 2\"))\n",
"\n",
"fig3.layout = dict(yaxis=dict(range=[-2,2]), xaxis=dict(range=[0,0.2]),width = 900)\n",
"\n",
"fig3.update_layout(\n",
" title={\n",
" 'text': r'$y = \\sin(2 \\pi f_1 t) + \\sin(2 \\pi f_2 t)$',\n",
" 'y':0.85,\n",
" 'x':0.5,\n",
" 'xanchor': 'center',\n",
" 'yanchor': 'top'})\n",
"\n",
"fig3.update_xaxes(\n",
" title_text = r\"$t \\text{ (seconds})$\",\n",
" title_standoff = 15,\n",
" ticks = 'outside',\n",
" ticklen = 10,\n",
" tickcolor='white')\n",
"\n",
"fig3.update_yaxes(\n",
" title_text = '',\n",
" title_standoff = 25,\n",
" ticks = 'outside',\n",
" ticklen = 10,\n",
" tickcolor = 'white')\n",
"\n",
"fig3.update_layout(showlegend=False)\n",
"\n",
"def on_button_clicked(_):\n",
" \n",
" with sound_out:\n",
" \n",
" framerate = 44100\n",
" sec = 2\n",
" t = np.linspace(0, sec, framerate * sec)\n",
" data = np.sin(2 * np.pi * f1.value * t) + np.sin(2 * np.pi * f2.value * t)\n",
" display(Audio(data, rate=framerate, autoplay=True))\n",
" clear_output(wait = True)\n",
"\n",
"def update_trace(freq1, freq2):\n",
" \n",
" fig3.data[0].y = np.sin(2*np.pi*freq1*xs3) + np.sin(2*np.pi*freq2*xs3)\n",
" fig3.data[1].y = np.sin(2*np.pi*freq1*xs3)\n",
" fig3.data[2].y = np.sin(2*np.pi*freq2*xs3)\n",
"\n",
"button.on_click(on_button_clicked)\n",
"\n",
"\n",
"widgets.VBox([fig3,button])\n",
"vb = widgets.VBox((fig3, interactive(update_trace, freq1 = f1, freq2 = f2), button))\n",
"vb.layout.align_items = 'center'\n",
"\n",
"display(vb)\n",
"display(sound_out)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Some fun things to try:\n",
"- pick two frequencies very close to each other (e.g. 200 and 205 Hz); the fluctuating amplitude is known as a *beat frequency*\n",
"- pick two frequencies with a 2:1 ratio (e.g. 400 and 200 Hz); this is interval is known as an *octave*\n",
"- pick two frequencies with a 3:2 ratio (e.g. 300 and 200 Hz); this is interval is known as a *perfect fifth*\n",
"- pick two frequencies with a 5:4 ratio (e.g. 250 and 200 Hz); this is interval is known as a *major third*\n",
"- wonder why \"simple\" frequency ratios produce \"consonant\" (pleasing) music intervals, regardless of experience/training\n",
"- try to create a consistent 12-tone tuning system and [struggle with the rational root theorem](https://youtu.be/1Hqm0dYKUx4)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Index\n",
"\n",
"1. [Sine waves](#wave)\n",
"2. [Traveling waves](#traveling)\n",
"3. [Listening to waves](#sound)"
]
}
],
"metadata": {
"history": [
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.arange(1, 2000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (1, 1000, 1), phi = (0, 3.14, 0.01))\ndef update(f = 50, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,2000]), height=600)\n\nfig.update_layout(\n title={\n 'text': \"Maxwell-Boltzmann Distribution\",\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"molecular speed [m/s]\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"probability density\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:33:22.441Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:33:23.445Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (1, 1000, 1), phi = (0, 3.14, 0.01))\ndef update(f = 50, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': \"Maxwell-Boltzmann Distribution\",\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"molecular speed [m/s]\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"probability density\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:34:00.388Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:34:00.688Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (1, 20, 0.1), phi = (0, 3.14, 0.01))\ndef update(f = 50, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': \"Maxwell-Boltzmann Distribution\",\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"molecular speed [m/s]\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"probability density\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:34:28.972Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:34:29.256Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 20, 0.1), phi = (0, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': \"Maxwell-Boltzmann Distribution\",\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"molecular speed [m/s]\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"probability density\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:34:44.062Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:34:44.343Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 20, 0.1), phi = (-3.14, 3.14, 0.1))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': \"Maxwell-Boltzmann Distribution\",\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"molecular speed [m/s]\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"probability density\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:35:01.870Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:35:02.150Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 20, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': \"Maxwell-Boltzmann Distribution\",\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"molecular speed [m/s]\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"probability density\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:35:13.990Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:35:14.250Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 10, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': \"Maxwell-Boltzmann Distribution\",\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"molecular speed [m/s]\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"probability density\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:36:06.269Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:36:06.574Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 10, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r\"\\sin(2 \\pi x + \\phi)\",\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:37:45.679Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:37:45.927Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 10, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r'\\sin(2 \\pi x + \\phi)',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:37:55.407Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:37:55.630Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 10, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r'$\\sin(2 \\pi x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:38:20.408Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:38:20.677Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 10, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r'$\\sin(2 \\pi x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:38:24.639Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:38:24.931Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 10, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:38:44.144Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:38:44.393Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(200, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 10, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:40:37.133Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:40:37.384Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\nfrom ipywidgets import interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n@interact(f = (0.1, 10, 0.1), phi = (-3.14, 3.14, 0.01))\ndef update(f = 1, phi = 0):\n with fig.batch_update():\n fig.data[0].y=wave(f, phi, xs)\n\n# Formatting\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n# Display figure\nfig",
"id": "9414e3cae98d4c40816d196642dd658f",
"idx": 1,
"time": "2021-02-01T23:43:41.600Z",
"type": "execution"
},
{
"id": "9414e3cae98d4c40816d196642dd658f",
"time": "2021-02-01T23:43:41.849Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nimport plotly.offline as py\nimport plotly\n\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\npy.init_notebook_mode()\n\n# load fig\nfig = plotly.plotly.get_figure(\"https://plotly.com/~jordanpeterson/889\")\n\n# find the range of the slider.\nxmin, xmax = fig['layout']['xaxis']['range']\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatRangeSlider(\n min=xmin,\n max=xmax,\n step=(xmax - xmin) / 1000.0,\n readout=False,\n description='Time')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(y):\n f.layout.xaxis.range = [y[0], y[1]]\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, y=slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:45:11.621Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:45:13.339Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatRangeSlider(\n min=0,\n max=10,\n step=0.1,\n readout=False,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(y):\n fig.data[0].y=wave(f, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, y=slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:47:54.127Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:47:54.429Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.Floatlider(\n min=0,\n max=10,\n step=0.1,\n readout=False,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(y):\n fig.data[0].y=wave(f, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, y=slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:48:03.308Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:48:03.509Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n min=0,\n max=10,\n step=0.1,\n readout=False,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(y):\n fig.data[0].y=wave(f, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, y=slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:48:12.087Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:48:12.351Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n min=0,\n max=10,\n step=0.1,\n readout=False,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(y):\n fig.data[0].y=wave(f, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:50:11.842Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:50:12.081Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n min=0,\n max=10,\n step=0.1,\n readout=False,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(f, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:50:29.222Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:50:29.473Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nwidgets.FloatSlider(\n value=7.5,\n min=0,\n max=10.0,\n step=0.1,\n description='Test:',\n disabled=False,\n continuous_update=False,\n orientation='horizontal',\n readout=True,\n readout_format='.1f',\n)\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(f, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:52:05.125Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:52:05.417Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n value=7.5,\n min=0,\n max=10.0,\n step=0.1,\n description='Test:',\n disabled=False,\n continuous_update=False,\n orientation='horizontal',\n readout=True,\n readout_format='.1f',\n)\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(f, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:52:18.575Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:52:18.871Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n value=7.5,\n min=0,\n max=10.0,\n step=0.1,\n description='Test:',\n disabled=False,\n continuous_update=False,\n orientation='horizontal',\n readout=True,\n readout_format='.1f',\n)\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(f.value, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:52:29.555Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:52:29.856Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n value=7.5,\n min=0,\n max=10.0,\n step=0.1,\n description='Test:',\n disabled=False,\n continuous_update=False,\n orientation='horizontal',\n readout=True,\n readout_format='.1f',\n)\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency.value, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:52:39.016Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:52:39.350Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n value=7.5,\n min=0,\n max=10.0,\n step=0.1,\n description='Test:',\n disabled=False,\n continuous_update=False,\n orientation='horizontal',\n readout=True,\n readout_format='.1f',\n)\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:52:46.666Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:52:47.020Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n value=7.5,\n min=0,\n max=10.0,\n step=0.1,\n description='Test:',\n disabled=False,\n continuous_update=True,\n orientation='horizontal',\n readout=True,\n readout_format='.1f',\n)\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:53:04.904Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:53:05.201Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n min=0,\n max=10,\n step=0.1,\n readout=False,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:53:43.935Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:53:44.175Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n min=0,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:54:02.215Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:54:02.525Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n min=0,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:55:06.997Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:55:07.327Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n min=0,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n f.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:55:21.043Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:55:21.362Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n min=0,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n f.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:55:34.660Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:55:35.010Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\n\n# create FigureWidget from fig\nf = go.FigureWidget(data=fig.data, layout=fig.layout)\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n f.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((f, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:56:33.611Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:56:33.892Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:57:32.090Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:57:32.313Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:58:21.988Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:58:22.270Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '800px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency):\n fig.data[0].y=wave(frequency, 0, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:58:46.689Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:58:46.964Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description='phi')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-01T23:59:51.717Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-01T23:59:52.008Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=800)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description='phi')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:00:27.572Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:00:27.911Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=800, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description='phi')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:00:34.817Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:00:35.100Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description='frequency')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description='phi')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:00:41.534Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:00:41.921Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description='phi')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:01:11.768Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:01:12.100Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = \"x\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = \"y\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:01:27.979Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:01:28.271Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = r\"$y$\",\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:02:04.338Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:02:04.631Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height=600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:02:30.836Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:02:31.166Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]))\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:03:31.148Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:03:31.508Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]))\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\n#slider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\n#slider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:03:38.740Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:03:39.049Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]))\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.8,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\n#slider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\n#slider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:03:57.156Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:03:57.487Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000) #\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\n# Plotting\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]))\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\n#slider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\n#slider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:04:01.880Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:04:02.246Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), autosize=True)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\n#slider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\n#slider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:06:01.025Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:06:01.380Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height = 600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\n#slider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\n#slider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:06:47.111Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:06:47.405Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height = 600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:06:54.793Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:06:55.108Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height = 600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.9,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 2,
"time": "2021-02-02T00:07:15.961Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:07:16.291Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height = 600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T00:09:56.506Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:09:56.824Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]), height = 600, width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T00:10:15.436Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:10:15.725Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T00:11:54.428Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:11:54.778Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T00:12:50.245Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T00:12:50.550Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nt = np.linspace(-1, 1, 100)\nx = t + t ** 2\ny = t - t ** 2\nxm = np.min(x) - 1.5\nxM = np.max(x) + 1.5\nym = np.min(y) - 1.5\nyM = np.max(y) + 1.5\nN = 50\ns = np.linspace(-1, 1, N)\nxx = s + s ** 2\nyy = s - s ** 2\n\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=x, y=y,\n mode=\"lines\",\n line=dict(width=2, color=\"blue\")),\n go.Scatter(x=x, y=y,\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n xaxis=dict(range=[xm, xM], autorange=False, zeroline=False),\n yaxis=dict(range=[ym, yM], autorange=False, zeroline=False),\n title_text=\"Kinematic Generation of a Planar Curve\", hovermode=\"closest\",\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=[xx[k]],\n y=[yy[k]],\n mode=\"markers\",\n marker=dict(color=\"red\", size=10))])\n\n for k in range(N)]\n)\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:22:12.645Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:22:12.897Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=x, y=wave(1, 0, xs, ts),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\")),\n go.Scatter(x=x, y=wave(1, 0, xs, ts),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:24:55.775Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:24:55.853Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=x, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\")),\n go.Scatter(x=x, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:25:09.833Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:25:10.482Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\")),\n go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:25:23.365Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:25:24.112Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:25:47.400Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:25:48.207Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\n\nsliders_dict = {\n \"active\": 0,\n \"yanchor\": \"top\",\n \"xanchor\": \"left\",\n \"currentvalue\": {\n \"font\": {\"size\": 20},\n \"prefix\": \"Year:\",\n \"visible\": True,\n \"xanchor\": \"right\"\n },\n \"transition\": {\"duration\": 300, \"easing\": \"cubic-in-out\"},\n \"pad\": {\"b\": 10, \"t\": 50},\n \"len\": 0.9,\n \"x\": 0.1,\n \"y\": 0,\n \"steps\": []\n}\n\nfig_dict[\"layout\"][\"sliders\"] = [sliders_dict]\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:28:09.310Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:28:09.397Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\n\nsliders_dict = {\n \"active\": 0,\n \"yanchor\": \"top\",\n \"xanchor\": \"left\",\n \"currentvalue\": {\n \"font\": {\"size\": 20},\n \"prefix\": \"Year:\",\n \"visible\": True,\n \"xanchor\": \"right\"\n },\n \"transition\": {\"duration\": 300, \"easing\": \"cubic-in-out\"},\n \"pad\": {\"b\": 10, \"t\": 50},\n \"len\": 0.9,\n \"x\": 0.1,\n \"y\": 0,\n \"steps\": []\n}\n\nfig.dict[\"layout\"][\"sliders\"] = [sliders_dict]\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:28:19.732Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:28:19.817Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\n\nsliders_dict = {\n \"active\": 0,\n \"yanchor\": \"top\",\n \"xanchor\": \"left\",\n \"currentvalue\": {\n \"font\": {\"size\": 20},\n \"prefix\": \"Year:\",\n \"visible\": True,\n \"xanchor\": \"right\"\n },\n \"transition\": {\"duration\": 300, \"easing\": \"cubic-in-out\"},\n \"pad\": {\"b\": 10, \"t\": 50},\n \"len\": 0.9,\n \"x\": 0.1,\n \"y\": 0,\n \"steps\": []\n}\n\nfig.dict.layout[\"sliders\"] = [sliders_dict]\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:28:28.375Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:28:28.461Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\n\nsliders_dict = {\n \"active\": 0,\n \"yanchor\": \"top\",\n \"xanchor\": \"left\",\n \"currentvalue\": {\n \"font\": {\"size\": 20},\n \"prefix\": \"Year:\",\n \"visible\": True,\n \"xanchor\": \"right\"\n },\n \"transition\": {\"duration\": 300, \"easing\": \"cubic-in-out\"},\n \"pad\": {\"b\": 10, \"t\": 50},\n \"len\": 0.9,\n \"x\": 0.1,\n \"y\": 0,\n \"steps\": []\n}\n\nfig.dic.layout[\"sliders\"] = [sliders_dict]\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:28:32.388Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:28:32.480Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 2, 10)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\n\nsliders_dict = {\n \"active\": 0,\n \"yanchor\": \"top\",\n \"xanchor\": \"left\",\n \"currentvalue\": {\n \"font\": {\"size\": 20},\n \"prefix\": \"Year:\",\n \"visible\": True,\n \"xanchor\": \"right\"\n },\n \"transition\": {\"duration\": 300, \"easing\": \"cubic-in-out\"},\n \"pad\": {\"b\": 10, \"t\": 50},\n \"len\": 0.9,\n \"x\": 0.1,\n \"y\": 0,\n \"steps\": []\n}\n\nfig.layout[\"sliders\"] = [sliders_dict]\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:28:36.972Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:28:37.853Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 5, 100)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:29:45.311Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:29:50.562Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 5, 20)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None, {\"frame\": {\"duration\": 200, \"redraw\": False}}])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\n\nfig.show()",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:31:09.256Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:31:10.563Z",
"type": "completion"
},
{
"code": "%%capture\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:38:26.010Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:38:26.104Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\n\n%%capture\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:38:36.384Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:38:36.686Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:38:40.534Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:38:41.055Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:38:57.029Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:38:57.317Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 5, 20)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x - phi* t)\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None, {\"frame\": {\"duration\": 200, \"redraw\": False}}])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\nvb = VBox((fig, interactive(update_range, omega = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:41:36.662Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:41:36.797Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 5, 20)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x - phi* t)\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None, {\"frame\": {\"duration\": 200, \"redraw\": False}}])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\ndef update_range(omega):\n fig.data[0].y=wave(1, omega, xs, t[0])\n\n\nvb = VBox((fig, interactive(update_range, omega = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:42:21.374Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:42:23.355Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 5, 20)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x - phi* t)\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# Create figure\nfig = go.Figure(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None, {\"frame\": {\"duration\": 200, \"redraw\": False}}])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\ndef update_range(omega):\n pass\n #fig.data[0].y=wave(1, omega, xs, t[0])\n\n\nvb = VBox((fig, interactive(update_range, omega = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:42:58.693Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:43:00.611Z",
"type": "completion"
},
{
"code": "import plotly.graph_objects as go\n\nimport numpy as np\n\n# Generate curve data\nts = np.linspace(0, 5, 20)\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x - phi* t)\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# Create figure\nfig = go.FigureWidget(\n data=[go.Scatter(x=xs, y=wave(1, 0, xs, ts[0]),\n mode=\"lines\",\n line=dict(width=2, color=\"blue\"))],\n layout=go.Layout(\n updatemenus=[dict(type=\"buttons\",\n buttons=[dict(label=\"Play\",\n method=\"animate\",\n args=[None, {\"frame\": {\"duration\": 200, \"redraw\": False}}])])]),\n frames=[go.Frame(\n data=[go.Scatter(\n x=xs,\n y=wave(1, 0, xs, ts[k]),\n mode=\"lines\",)])\n\n for k in range(len(ts))]\n)\n\n\ndef update_range(omega):\n pass\n #fig.data[0].y=wave(1, omega, xs, t[0])\n\n\nvb = VBox((fig, interactive(update_range, omega = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"idx": 2,
"time": "2021-02-02T00:43:17.611Z",
"type": "execution"
},
{
"id": "a5587fed4ad3450f9ea8875a6d7be809",
"time": "2021-02-02T00:43:17.800Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n%matplotlib inline\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:44:30.937Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:44:31.852Z",
"type": "completion"
},
{
"code": "%matplotlib inline",
"id": "a0d60fee7f8d4fb78b4508f2e6001f12",
"idx": 4,
"time": "2021-02-02T00:45:13.178Z",
"type": "execution"
},
{
"id": "a0d60fee7f8d4fb78b4508f2e6001f12",
"time": "2021-02-02T00:45:13.241Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n\nanim",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:45:16.371Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:45:16.675Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n\nanim.show()",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:45:22.364Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:45:22.767Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n\nplt.show()",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:46:09.353Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:46:09.653Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n\nplt.show()",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:46:51.267Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:46:51.486Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:47:07.055Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:47:07.224Z",
"type": "completion"
},
{
"code": "%% capture\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:47:40.601Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:47:40.681Z",
"type": "completion"
},
{
"code": "% capture\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:47:47.181Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:47:47.260Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n\nrc('animation', html='html5')\n\nanim",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:51:27.303Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:51:27.608Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n\nrc('animation', html='html5')\n\nanim",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:51:39.778Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:51:42.780Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:51:56.832Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:51:56.965Z",
"type": "completion"
},
{
"code": "import matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:52:08.871Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:52:09.781Z",
"type": "completion"
},
{
"code": "%matplotlib inline\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:52:20.780Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:52:21.112Z",
"type": "completion"
},
{
"code": "%matplotlib inline\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\nanim",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:52:26.081Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:52:26.395Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\nanim",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:52:33.495Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:52:33.725Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(\\omega t - kx)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\nanim",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:52:42.745Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:52:42.930Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n\nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\nanim",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:53:27.337Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:53:27.465Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, omega):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - omega * i/100))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef on_button_clicked(_):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nwidgets.VBox([button,out,fig])",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:57:22.425Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:57:22.660Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, omega):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - omega * i/100))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef on_button_clicked(_):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nwidgets.VBox([button,out])",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:57:38.304Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:57:38.489Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, omega):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - omega * i/100.))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef on_button_clicked(_):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nwidgets.VBox([button,out])",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T00:58:36.410Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T00:58:36.599Z",
"type": "completion"
},
{
"code": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nimport mpl_toolkits.axes_grid1\nimport matplotlib.widgets\n\nclass Player(FuncAnimation):\n def __init__(self, fig, func, frames=None, init_func=None, fargs=None,\n save_count=None, mini=0, maxi=100, pos=(0.125, 0.92), **kwargs):\n self.i = 0\n self.min=mini\n self.max=maxi\n self.runs = True\n self.forwards = True\n self.fig = fig\n self.func = func\n self.setup(pos)\n FuncAnimation.__init__(self,self.fig, self.func, frames=self.play(), \n init_func=init_func, fargs=fargs,\n save_count=save_count, **kwargs ) \n\n def play(self):\n while self.runs:\n self.i = self.i+self.forwards-(not self.forwards)\n if self.i > self.min and self.i < self.max:\n yield self.i\n else:\n self.stop()\n yield self.i\n\n def start(self):\n self.runs=True\n self.event_source.start()\n\n def stop(self, event=None):\n self.runs = False\n self.event_source.stop()\n\n def forward(self, event=None):\n self.forwards = True\n self.start()\n def backward(self, event=None):\n self.forwards = False\n self.start()\n def oneforward(self, event=None):\n self.forwards = True\n self.onestep()\n def onebackward(self, event=None):\n self.forwards = False\n self.onestep()\n\n def onestep(self):\n if self.i > self.min and self.i < self.max:\n self.i = self.i+self.forwards-(not self.forwards)\n elif self.i == self.min and self.forwards:\n self.i+=1\n elif self.i == self.max and not self.forwards:\n self.i-=1\n self.func(self.i)\n self.fig.canvas.draw_idle()\n\n def setup(self, pos):\n playerax = self.fig.add_axes([pos[0],pos[1], 0.22, 0.04])\n divider = mpl_toolkits.axes_grid1.make_axes_locatable(playerax)\n bax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n sax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n fax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n ofax = divider.append_axes(\"right\", size=\"100%\", pad=0.05)\n self.button_oneback = matplotlib.widgets.Button(playerax, label=ur'$\\u29CF$')\n self.button_back = matplotlib.widgets.Button(bax, label=u'$\\u25C0$')\n self.button_stop = matplotlib.widgets.Button(sax, label=u'$\\u25A0$')\n self.button_forward = matplotlib.widgets.Button(fax, label=u'$\\u25B6$')\n self.button_oneforward = matplotlib.widgets.Button(ofax, label=u'$\\u29D0$')\n self.button_oneback.on_clicked(self.onebackward)\n self.button_back.on_clicked(self.backward)\n self.button_stop.on_clicked(self.stop)\n self.button_forward.on_clicked(self.forward)\n self.button_oneforward.on_clicked(self.oneforward)\n\n### using this class is as easy as using FuncAnimation: \n\nfig, ax = plt.subplots()\nx = np.linspace(0,6*np.pi, num=100)\ny = np.sin(x)\n\nax.plot(x,y)\npoint, = ax.plot([],[], marker=\"o\", color=\"crimson\", ms=15)\n\ndef update(i):\n point.set_data(x[i],y[i])\n\nani = Player(fig, update, maxi=len(y)-1)\n\nplt.show()",
"id": "3aa5662cb2934131b75564caf9af9ad8",
"idx": 5,
"time": "2021-02-02T00:59:55.711Z",
"type": "execution"
},
{
"id": "3aa5662cb2934131b75564caf9af9ad8",
"time": "2021-02-02T00:59:55.792Z",
"type": "completion"
},
{
"code": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nimport mpl_toolkits.axes_grid1\nimport matplotlib.widgets\n\nclass Player(FuncAnimation):\n def __init__(self, fig, func, frames=None, init_func=None, fargs=None,\n save_count=None, mini=0, maxi=100, pos=(0.125, 0.92), **kwargs):\n self.i = 0\n self.min=mini\n self.max=maxi\n self.runs = True\n self.forwards = True\n self.fig = fig\n self.func = func\n self.setup(pos)\n FuncAnimation.__init__(self,self.fig, self.func, frames=self.play(), \n init_func=init_func, fargs=fargs,\n save_count=save_count, **kwargs ) \n\n def play(self):\n while self.runs:\n self.i = self.i+self.forwards-(not self.forwards)\n if self.i > self.min and self.i < self.max:\n yield self.i\n else:\n self.stop()\n yield self.i\n\n def start(self):\n self.runs=True\n self.event_source.start()\n\n def stop(self, event=None):\n self.runs = False\n self.event_source.stop()\n\n def forward(self, event=None):\n self.forwards = True\n self.start()\n def backward(self, event=None):\n self.forwards = False\n self.start()\n def oneforward(self, event=None):\n self.forwards = True\n self.onestep()\n def onebackward(self, event=None):\n self.forwards = False\n self.onestep()\n\n def onestep(self):\n if self.i > self.min and self.i < self.max:\n self.i = self.i+self.forwards-(not self.forwards)\n elif self.i == self.min and self.forwards:\n self.i+=1\n elif self.i == self.max and not self.forwards:\n self.i-=1\n self.func(self.i)\n self.fig.canvas.draw_idle()\n\n def setup(self, pos):\n playerax = self.fig.add_axes([pos[0],pos[1], 0.22, 0.04])\n divider = mpl_toolkits.axes_grid1.make_axes_locatable(playerax)\n bax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n sax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n fax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n ofax = divider.append_axes(\"right\", size=\"100%\", pad=0.05)\n self.button_oneback = matplotlib.widgets.Button(playerax, label=u'$\\u29CF$')\n self.button_back = matplotlib.widgets.Button(bax, label=u'$\\u25C0$')\n self.button_stop = matplotlib.widgets.Button(sax, label=u'$\\u25A0$')\n self.button_forward = matplotlib.widgets.Button(fax, label=u'$\\u25B6$')\n self.button_oneforward = matplotlib.widgets.Button(ofax, label=u'$\\u29D0$')\n self.button_oneback.on_clicked(self.onebackward)\n self.button_back.on_clicked(self.backward)\n self.button_stop.on_clicked(self.stop)\n self.button_forward.on_clicked(self.forward)\n self.button_oneforward.on_clicked(self.oneforward)\n\n### using this class is as easy as using FuncAnimation: \n\nfig, ax = plt.subplots()\nx = np.linspace(0,6*np.pi, num=100)\ny = np.sin(x)\n\nax.plot(x,y)\npoint, = ax.plot([],[], marker=\"o\", color=\"crimson\", ms=15)\n\ndef update(i):\n point.set_data(x[i],y[i])\n\nani = Player(fig, update, maxi=len(y)-1)\n\nplt.show()",
"id": "3aa5662cb2934131b75564caf9af9ad8",
"idx": 5,
"time": "2021-02-02T01:00:07.733Z",
"type": "execution"
},
{
"id": "3aa5662cb2934131b75564caf9af9ad8",
"time": "2021-02-02T01:00:07.934Z",
"type": "completion"
},
{
"code": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nimport mpl_toolkits.axes_grid1\nimport matplotlib.widgets\n\nclass Player(FuncAnimation):\n def __init__(self, fig, func, frames=None, init_func=None, fargs=None,\n save_count=None, mini=0, maxi=100, pos=(0.125, 0.92), **kwargs):\n self.i = 0\n self.min=mini\n self.max=maxi\n self.runs = True\n self.forwards = True\n self.fig = fig\n self.func = func\n self.setup(pos)\n FuncAnimation.__init__(self,self.fig, self.func, frames=self.play(), \n init_func=init_func, fargs=fargs,\n save_count=save_count, **kwargs ) \n\n def play(self):\n while self.runs:\n self.i = self.i+self.forwards-(not self.forwards)\n if self.i > self.min and self.i < self.max:\n yield self.i\n else:\n self.stop()\n yield self.i\n\n def start(self):\n self.runs=True\n self.event_source.start()\n\n def stop(self, event=None):\n self.runs = False\n self.event_source.stop()\n\n def forward(self, event=None):\n self.forwards = True\n self.start()\n def backward(self, event=None):\n self.forwards = False\n self.start()\n def oneforward(self, event=None):\n self.forwards = True\n self.onestep()\n def onebackward(self, event=None):\n self.forwards = False\n self.onestep()\n\n def onestep(self):\n if self.i > self.min and self.i < self.max:\n self.i = self.i+self.forwards-(not self.forwards)\n elif self.i == self.min and self.forwards:\n self.i+=1\n elif self.i == self.max and not self.forwards:\n self.i-=1\n self.func(self.i)\n self.fig.canvas.draw_idle()\n\n def setup(self, pos):\n playerax = self.fig.add_axes([pos[0],pos[1], 0.22, 0.04])\n divider = mpl_toolkits.axes_grid1.make_axes_locatable(playerax)\n bax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n sax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n fax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n ofax = divider.append_axes(\"right\", size=\"100%\", pad=0.05)\n self.button_oneback = matplotlib.widgets.Button(playerax, label=u'$\\u29CF$')\n self.button_back = matplotlib.widgets.Button(bax, label=u'$\\u25C0$')\n self.button_stop = matplotlib.widgets.Button(sax, label=u'$\\u25A0$')\n self.button_forward = matplotlib.widgets.Button(fax, label=u'$\\u25B6$')\n self.button_oneforward = matplotlib.widgets.Button(ofax, label=u'$\\u29D0$')\n self.button_oneback.on_clicked(self.onebackward)\n self.button_back.on_clicked(self.backward)\n self.button_stop.on_clicked(self.stop)\n self.button_forward.on_clicked(self.forward)\n self.button_oneforward.on_clicked(self.oneforward)\n\n### using this class is as easy as using FuncAnimation: \n\nfig, ax = plt.subplots()\nx = np.linspace(0,6*np.pi, num=100)\ny = np.sin(x)\n\nax.plot(x,y)\npoint, = ax.plot([],[], marker=\"o\", color=\"crimson\", ms=15)\n\ndef update(i):\n point.set_data(x[i],y[i])\n\nani = Player(fig, update, maxi=len(y)-1)\n\nplt.show()",
"id": "3aa5662cb2934131b75564caf9af9ad8",
"idx": 5,
"time": "2021-02-02T01:00:47.988Z",
"type": "execution"
},
{
"id": "3aa5662cb2934131b75564caf9af9ad8",
"time": "2021-02-02T01:00:49.007Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nimport mpl_toolkits.axes_grid1\nimport matplotlib.widgets\n\nclass Player(FuncAnimation):\n def __init__(self, fig, func, frames=None, init_func=None, fargs=None,\n save_count=None, mini=0, maxi=100, pos=(0.125, 0.92), **kwargs):\n self.i = 0\n self.min=mini\n self.max=maxi\n self.runs = True\n self.forwards = True\n self.fig = fig\n self.func = func\n self.setup(pos)\n FuncAnimation.__init__(self,self.fig, self.func, frames=self.play(), \n init_func=init_func, fargs=fargs,\n save_count=save_count, **kwargs ) \n\n def play(self):\n while self.runs:\n self.i = self.i+self.forwards-(not self.forwards)\n if self.i > self.min and self.i < self.max:\n yield self.i\n else:\n self.stop()\n yield self.i\n\n def start(self):\n self.runs=True\n self.event_source.start()\n\n def stop(self, event=None):\n self.runs = False\n self.event_source.stop()\n\n def forward(self, event=None):\n self.forwards = True\n self.start()\n def backward(self, event=None):\n self.forwards = False\n self.start()\n def oneforward(self, event=None):\n self.forwards = True\n self.onestep()\n def onebackward(self, event=None):\n self.forwards = False\n self.onestep()\n\n def onestep(self):\n if self.i > self.min and self.i < self.max:\n self.i = self.i+self.forwards-(not self.forwards)\n elif self.i == self.min and self.forwards:\n self.i+=1\n elif self.i == self.max and not self.forwards:\n self.i-=1\n self.func(self.i)\n self.fig.canvas.draw_idle()\n\n def setup(self, pos):\n playerax = self.fig.add_axes([pos[0],pos[1], 0.22, 0.04])\n divider = mpl_toolkits.axes_grid1.make_axes_locatable(playerax)\n bax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n sax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n fax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n ofax = divider.append_axes(\"right\", size=\"100%\", pad=0.05)\n self.button_oneback = matplotlib.widgets.Button(playerax, label=u'$\\u29CF$')\n self.button_back = matplotlib.widgets.Button(bax, label=u'$\\u25C0$')\n self.button_stop = matplotlib.widgets.Button(sax, label=u'$\\u25A0$')\n self.button_forward = matplotlib.widgets.Button(fax, label=u'$\\u25B6$')\n self.button_oneforward = matplotlib.widgets.Button(ofax, label=u'$\\u29D0$')\n self.button_oneback.on_clicked(self.onebackward)\n self.button_back.on_clicked(self.backward)\n self.button_stop.on_clicked(self.stop)\n self.button_forward.on_clicked(self.forward)\n self.button_oneforward.on_clicked(self.oneforward)\n\n### using this class is as easy as using FuncAnimation: \n\nfig, ax = plt.subplots()\nx = np.linspace(0,6*np.pi, num=100)\ny = np.sin(x)\n\nax.plot(x,y)\npoint, = ax.plot([],[], marker=\"o\", color=\"crimson\", ms=15)\n\ndef update(i):\n point.set_data(x[i],y[i])\n\nani = Player(fig, update, maxi=len(y)-1)\n\nplt.show()",
"id": "3aa5662cb2934131b75564caf9af9ad8",
"idx": 5,
"time": "2021-02-02T01:01:03.135Z",
"type": "execution"
},
{
"id": "3aa5662cb2934131b75564caf9af9ad8",
"time": "2021-02-02T01:01:03.344Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nimport mpl_toolkits.axes_grid1\nimport matplotlib.widgets\n\nclass Player(FuncAnimation):\n def __init__(self, fig, func, frames=None, init_func=None, fargs=None,\n save_count=None, mini=0, maxi=100, pos=(0.125, 0.92), **kwargs):\n self.i = 0\n self.min=mini\n self.max=maxi\n self.runs = True\n self.forwards = True\n self.fig = fig\n self.func = func\n self.setup(pos)\n FuncAnimation.__init__(self,self.fig, self.update, frames=self.play(), \n init_func=init_func, fargs=fargs,\n save_count=save_count, **kwargs ) \n\n def play(self):\n while self.runs:\n self.i = self.i+self.forwards-(not self.forwards)\n if self.i > self.min and self.i < self.max:\n yield self.i\n else:\n self.stop()\n yield self.i\n\n def start(self):\n self.runs=True\n self.event_source.start()\n\n def stop(self, event=None):\n self.runs = False\n self.event_source.stop()\n\n def forward(self, event=None):\n self.forwards = True\n self.start()\n def backward(self, event=None):\n self.forwards = False\n self.start()\n def oneforward(self, event=None):\n self.forwards = True\n self.onestep()\n def onebackward(self, event=None):\n self.forwards = False\n self.onestep()\n\n def onestep(self):\n if self.i > self.min and self.i < self.max:\n self.i = self.i+self.forwards-(not self.forwards)\n elif self.i == self.min and self.forwards:\n self.i+=1\n elif self.i == self.max and not self.forwards:\n self.i-=1\n self.func(self.i)\n self.slider.set_val(self.i)\n self.fig.canvas.draw_idle()\n\n def setup(self, pos):\n playerax = self.fig.add_axes([pos[0],pos[1], 0.64, 0.04])\n divider = mpl_toolkits.axes_grid1.make_axes_locatable(playerax)\n bax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n sax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n fax = divider.append_axes(\"right\", size=\"80%\", pad=0.05)\n ofax = divider.append_axes(\"right\", size=\"100%\", pad=0.05)\n sliderax = divider.append_axes(\"right\", size=\"500%\", pad=0.07)\n self.button_oneback = matplotlib.widgets.Button(playerax, label='$\\u29CF$')\n self.button_back = matplotlib.widgets.Button(bax, label='$\\u25C0$')\n self.button_stop = matplotlib.widgets.Button(sax, label='$\\u25A0$')\n self.button_forward = matplotlib.widgets.Button(fax, label='$\\u25B6$')\n self.button_oneforward = matplotlib.widgets.Button(ofax, label='$\\u29D0$')\n self.button_oneback.on_clicked(self.onebackward)\n self.button_back.on_clicked(self.backward)\n self.button_stop.on_clicked(self.stop)\n self.button_forward.on_clicked(self.forward)\n self.button_oneforward.on_clicked(self.oneforward)\n self.slider = matplotlib.widgets.Slider(sliderax, '', \n self.min, self.max, valinit=self.i)\n self.slider.on_changed(self.set_pos)\n\n def set_pos(self,i):\n self.i = int(self.slider.val)\n self.func(self.i)\n\n def update(self,i):\n self.slider.set_val(i)\n\n\n### using this class is as easy as using FuncAnimation: \n\nfig, ax = plt.subplots()\nx = np.linspace(0,6*np.pi, num=100)\ny = np.sin(x)\n\nax.plot(x,y)\npoint, = ax.plot([],[], marker=\"o\", color=\"crimson\", ms=15)\n\ndef update(i):\n point.set_data(x[i],y[i])\n\nani = Player(fig, update, maxi=len(y)-1)\n\nplt.show()",
"id": "3aa5662cb2934131b75564caf9af9ad8",
"idx": 5,
"time": "2021-02-02T01:01:47.927Z",
"type": "execution"
},
{
"id": "3aa5662cb2934131b75564caf9af9ad8",
"time": "2021-02-02T01:01:48.222Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, om):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - om * i/100.))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef on_button_clicked(_):\n \n anim = animation.FuncAnimation(fig, animate(omega.value), init_func=init,\n frames=100, interval=20, \n blit=True)\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nwidgets.VBox([button,out])",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T01:03:27.624Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T01:03:27.842Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, om):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - om * i/100.))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef on_button_clicked(_):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True, fargs=(omega.value,))\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nwidgets.VBox([button,out])",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T01:04:25.003Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T01:04:25.184Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, om):\n print(om)\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - om * i/100.))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef on_button_clicked(_):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True, fargs=(omega.value,))\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nwidgets.VBox([button,out])",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T01:04:33.989Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T01:04:34.660Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, om):\n print(om)\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - om * i/100.))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef on_button_clicked(_):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True, fargs=(omega.value,))\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nwidgets.VBox([fig,button,out])",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T01:05:04.150Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T01:05:04.820Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, om):\n print(om)\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - om * i/100.))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef update_range(omega):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True, fargs=(omega,))\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nvb = VBox((fig, interactive(update_range, omega = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T01:06:38.466Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T01:06:39.136Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, om):\n print(om)\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - om * i/100.))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nomega = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef update_range(omega):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True, fargs=(omega,))\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nvb = widgets.VBox((fig, interactive(update_range, omega = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T01:06:59.391Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T01:06:59.578Z",
"type": "completion"
},
{
"code": "%matplotlib notebook\nimport matplotlib.pyplot as plt\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nfrom matplotlib import animation, rc\nimport numpy as np\nimport ipywidgets as widgets\n\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nax.set_title(r\"$f(x, t) = \\sin(kx - \\omega t)$\")\nax.set_xlabel('$x$')\nax.set_ylabel('$f(x, t)$')\nline, = ax.plot([], [], lw=2);\n\ndef init():\n line.set_data([], [])\n \n return (line,)\n\ndef animate(i, om):\n print(om)\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - om * i/100.))\n line.set_data(x, y)\n return (line,)\n\n\n\n\n\nslider2 = widgets.IntSlider(min = 1, max = 600, step = 1)\ndisplay(omega)\n\nbutton = widgets.Button(description='Play Animation')\nout = widgets.Output()\n\n\ndef update_range(omega):\n \n anim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True, fargs=(omega,))\n anim\n\n\n \n\n# linking button and function together using a button's method\nbutton.on_click(on_button_clicked)\n# displaying button and its output together\nvb = widgets.VBox((fig, interactive(update_range, omega = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "b867cdcce514443a9406fb127eed7e58",
"idx": 3,
"time": "2021-02-02T01:07:17.057Z",
"type": "execution"
},
{
"id": "b867cdcce514443a9406fb127eed7e58",
"time": "2021-02-02T01:07:17.319Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T01:08:13.210Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T01:08:13.713Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi, time):\n fig.data[0].y=wave(frequency, phi, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2, time = slider3)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:20:31.851Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:20:32.161Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi, time):\n fig.data[0].y=wave(frequency, phi, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2, time = slider3)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:20:39.108Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:20:39.477Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$',\n orientation=\"vertical\")\nslider3.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi, time):\n fig.data[0].y=wave(frequency, phi, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2, time = slider3)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:21:44.941Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:21:45.289Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi, time):\n fig.data[0].y=wave(frequency, phi, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2, time = slider3)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:22:29.700Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:22:30.022Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n# interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled=False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi, time):\n fig.data[0].y=wave(frequency, phi, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:25:36.447Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:25:36.812Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n# interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi, time):\n fig.data[0].y=wave(frequency, phi, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:25:48.039Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:25:48.352Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n# interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\"\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi, time):\n fig.data[0].y=wave(frequency, phi, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:25:50.752Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:25:51.121Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x, t):\n return np.sin(2*np.pi*f*x + phi - t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n# interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi, time):\n fig.data[0].y=wave(frequency, phi, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:26:01.676Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:26:01.987Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n# interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:27:55.684Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:27:56.099Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n# interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play/10)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:28:28.554Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:28:28.841Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n# interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time/10.)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:28:41.955Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:28:42.277Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n interval=5,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time/10.)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:29:14.657Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:29:14.947Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n interval=50,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time/10.)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:29:39.143Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:29:39.454Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n interval=50,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time/10.)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:29:44.130Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:29:44.462Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time/10.)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:29:55.325Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:29:55.633Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n#interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:30:16.212Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:30:16.526Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n#interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:30:39.918Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:30:40.093Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n#interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:30:46.971Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:30:47.731Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n#interval=10,\n value=0,\n min=0,\n max=100,\n step=1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:32:19.648Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:32:20.041Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n min=0,\n max=10,\n step=0.1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:33:00.173Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:33:00.530Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=10,\n step=0.1,\n description=\"Press play\",\n disabled = False\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:33:23.859Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:33:24.238Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=10,\n step=1\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:33:40.665Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:33:41.439Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 500)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=10,\n step=1\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:36:43.194Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:36:43.575Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 500)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=1000,\n step=1\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:37:12.721Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:37:13.098Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 500)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=1000,\n step=1\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:38:19.156Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:38:19.457Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 500)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:39:00.150Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:39:00.469Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 500)\n\ndef wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\n\n\n\n# our function that will modify the xaxis range\ndef update_range(k, omega, time):\n fig.data[0].y=wave(k, omega, xs, time)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\n#vb.layout.align_items = 'center'\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:39:13.144Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:39:13.755Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T01:39:35.390Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T01:39:35.680Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T01:41:52.601Z",
"type": "execution"
},
{
"code": "xs = np.linspace(0, 5, 500)\n\ndef traveling_wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=traveling_wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\ndef update_range(k, omega, time):\n fig.data[0].y=traveling_wave(k, omega, xs, time)\n\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:41:52.603Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T01:41:53.318Z",
"type": "completion"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:41:53.615Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T01:43:07.548Z",
"type": "execution"
},
{
"code": "xs = np.linspace(0, 5, 500)\n\ndef traveling_wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig2 = go.FigureWidget()\n\nfig2.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig2.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig2.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig2.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=traveling_wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\ndef update_range(k, omega, time):\n fig.data[0].y=traveling_wave(k, omega, xs, time)\n\nvb = VBox((fig, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:43:07.552Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T01:43:08.324Z",
"type": "completion"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:43:08.680Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T01:43:59.202Z",
"type": "execution"
},
{
"code": "xs = np.linspace(0, 5, 500)\n\ndef traveling_wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig2 = go.FigureWidget()\n\nfig2.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig2.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig2.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig2.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=traveling_wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nslider2.layout.width = '400px'\n\nslider3 = widgets.FloatSlider(\n value = 0,\n min= 0,\n max= 10,\n step=0.1,\n readout=True,\n description=r'$t$')\nslider3.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\ndef update_range(k, omega, time):\n fig2.data[0].y=traveling_wave(k, omega, xs, time)\n\nvb = VBox((fig2, interactive(update_range, k = slider, omega = slider2, time = play)))\nvb",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:43:59.205Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T01:43:59.927Z",
"type": "completion"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:44:00.222Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T01:45:40.468Z",
"type": "execution"
},
{
"code": "xs = np.linspace(0, 5, 500)\n\ndef traveling_wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig2 = go.FigureWidget()\n\nfig2.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig2.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig2.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig2.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=traveling_wave(1, 0, xs, 0),\n mode='lines',\n name='lines'))\n\nbslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nbslider.layout.width = '400px'\n\nbslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nbslider2.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\ndef update2(k, omega, time):\n fig2.data[0].y=traveling_wave(k, omega, xs, time)\n\nvb2 = VBox((fig2, interactive(update2, k = bslider, omega = bslider2, time = play)))\nvb2",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:45:40.471Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T01:45:41.129Z",
"type": "completion"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:45:41.357Z",
"type": "completion"
},
{
"code": "import plotly.graph_objs as go\nfrom ipywidgets import interactive, HBox, VBox, widgets, interact\nimport numpy as np\n\nxs = np.linspace(0, 5, 1000)\n\ndef wave(f, phi, x):\n return np.sin(2*np.pi*f*x + phi)\n\nfig = go.FigureWidget()\n\nfig.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig.update_layout(\n title={\n 'text': r'$y = \\sin(2 \\pi f x + \\phi)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline = fig.add_trace(go.Scatter(x=xs, y=wave(1, 0, xs),\n mode='lines',\n name='lines'))\n\nslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$f$')\nslider.layout.width = '400px'\n\nslider2 = widgets.FloatSlider(\n value = 0,\n min=-3.14,\n max=3.14,\n step=0.01,\n readout=True,\n description=r'$\\phi$')\nslider2.layout.width = '400px'\n\n\n# our function that will modify the xaxis range\ndef update_range(frequency, phi):\n fig.data[0].y=wave(frequency, phi, xs)\n\n\n# display the FigureWidget and slider with center justification\nvb = VBox((fig, interactive(update_range, frequency = slider, phi = slider2)))\nvb.layout.align_items = 'center'\nvb",
"id": "85736820b6ba488296e745512b629dd0",
"idx": 1,
"time": "2021-02-02T01:47:02.930Z",
"type": "execution"
},
{
"code": "xs2 = np.linspace(0, 5, 500)\n\ndef traveling_wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig2 = go.FigureWidget()\n\nfig2.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig2.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig2.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig2.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline2 = fig2.add_trace(go.Scatter(x=xs2, y=traveling_wave(1, 0, xs2, 0),\n mode='lines',\n name='lines'))\n\nbslider = widgets.FloatSlider(\n value = 1,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nbslider.layout.width = '400px'\n\nbslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nbslider2.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\ndef update2(k, omega, time):\n fig2.data[0].y=traveling_wave(k, omega, xs2, time)\n\nvb2 = VBox((fig2, interactive(update2, k = bslider, omega = bslider2, time = play)))\nvb2",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:47:02.933Z",
"type": "execution"
},
{
"id": "85736820b6ba488296e745512b629dd0",
"time": "2021-02-02T01:47:03.752Z",
"type": "completion"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:47:04.075Z",
"type": "completion"
},
{
"code": "xs2 = np.linspace(0, 5, 500)\n\ndef traveling_wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig2 = go.FigureWidget()\n\nfig2.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig2.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig2.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig2.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline2 = fig2.add_trace(go.Scatter(x=xs2, y=traveling_wave(1, 0, xs2, 0),\n mode='lines',\n name='lines'))\n\nbslider = widgets.FloatSlider(\n value = 0,\n min=0.1,\n max=10,\n step=0.1,\n readout=True,\n description=r'$k$')\nbslider.layout.width = '400px'\n\nbslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nbslider2.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\ndef update2(k, omega, time):\n fig2.data[0].y=traveling_wave(k, omega, xs2, time)\n\nvb2 = VBox((fig2, interactive(update2, k = bslider, omega = bslider2, time = play)))\nvb2",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:51:51.714Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:51:52.084Z",
"type": "completion"
},
{
"code": "xs2 = np.linspace(0, 5, 500)\n\ndef traveling_wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig2 = go.FigureWidget()\n\nfig2.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig2.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig2.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig2.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline2 = fig2.add_trace(go.Scatter(x=xs2, y=traveling_wave(1, 0, xs2, 0),\n mode='lines',\n name='lines'))\n\nbslider = widgets.FloatSlider(\n value = 3.14,\n min=0.1,\n max=10,\n step=0.01,\n readout=True,\n description=r'$k$')\nbslider.layout.width = '400px'\n\nbslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nbslider2.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\ndef update2(k, omega, time):\n fig2.data[0].y=traveling_wave(k, omega, xs2, time)\n\nvb2 = VBox((fig2, interactive(update2, k = bslider, omega = bslider2, time = play)))\nvb2",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:52:11.197Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:52:11.552Z",
"type": "completion"
},
{
"code": "xs2 = np.linspace(0, 5, 500)\n\ndef traveling_wave(k, omega, x, t):\n return np.sin(k*x - omega*t/10.)\n\nfig2 = go.FigureWidget()\n\nfig2.layout = dict(yaxis=dict(range=[-1,1]), xaxis=dict(range=[0,5]),width = 1000)\n\nfig2.update_layout(\n title={\n 'text': r'$y = \\sin(kx - \\omega t)$',\n 'y':0.85,\n 'x':0.5,\n 'xanchor': 'center',\n 'yanchor': 'top'})\n\nfig2.update_xaxes(\n title_text = r\"$x$\",\n title_standoff = 15,\n ticks = 'outside',\n ticklen = 10,\n tickcolor='white')\n\nfig2.update_yaxes(\n title_text = '',\n title_standoff = 25,\n ticks = 'outside',\n ticklen = 10,\n tickcolor = 'white')\n\n\nline2 = fig2.add_trace(go.Scatter(x=xs2, y=traveling_wave(1, 0, xs2, 0),\n mode='lines',\n name='lines'))\n\nbslider = widgets.FloatSlider(\n value = 3.14,\n min=0.1,\n max=10,\n step=0.02,\n readout=True,\n description=r'$k$')\nbslider.layout.width = '400px'\n\nbslider2 = widgets.FloatSlider(\n value = 0,\n min=-1,\n max=1,\n step=0.1,\n readout=True,\n description=r'$\\omega$')\nbslider2.layout.width = '400px'\n\nplay = widgets.Play(\n value = 0,\n min=0,\n max=500,\n step=1\n)\n\ndef update2(k, omega, time):\n fig2.data[0].y=traveling_wave(k, omega, xs2, time)\n\nvb2 = VBox((fig2, interactive(update2, k = bslider, omega = bslider2, time = play)))\nvb2",
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"idx": 2,
"time": "2021-02-02T01:52:34.358Z",
"type": "execution"
},
{
"id": "f15e0fd280db4a56b7301dad0a4e1307",
"time": "2021-02-02T01:52:34.735Z",
"type": "completion"
},
{
"code": "from IPython.display import Audio,display\n\ndef play(f1, f2, sec=3):\n framerate = 44100 # <- rate of sampling\n t = np.linspace(0, sec, framerate * sec) # <- setup time values\n data = np.sin(2 * np.pi * f1 * t) + np.sin(2 * np.pi * f2 * t) # <- sine function formula\n display(InvisibleAudio(data, rate=framerate, autoplay=True)) # play the generated sound\n return t[:2000], data[:2000]\n \n\nclass InvisibleAudio(Audio):\n def _repr_html_(self):\n audio = super()._repr_html_()\n audio = audio.replace('