Skip to content

Instantly share code, notes, and snippets.

@j-fu
Created September 11, 2020 10:05
Show Gist options
  • Save j-fu/52877beae4bbb9d60b378b14d35a2e23 to your computer and use it in GitHub Desktop.
Save j-fu/52877beae4bbb9d60b378b14d35a2e23 to your computer and use it in GitHub Desktop.
### A Pluto.jl notebook ###
# v0.11.14
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
el
end
end
# ╔═╡ c5b65438-f3a8-11ea-244c-f7ed186cef40
using PyPlot, PlutoUI
# ╔═╡ 30dd639a-f3b6-11ea-3700-2d2770333ac3
@bind k Slider(1:0.1:20)
# ╔═╡ 3e1acca4-f397-11ea-075f-b9118034bd23
X=collect(0:0.01:2)
# ╔═╡ f274ca9a-f3a8-11ea-210a-612a8d8ee463
Y=sin.(k*π*X)
# ╔═╡ 13a6459a-f3a9-11ea-26f2-554d6989f01e
begin
fig=PyPlot.figure(figsize=(5,3))
PyPlot.grid()
PyPlot.plot(X,Y)
PyPlot.title("k=$(k)")
fig
end
# ╔═╡ Cell order:
# ╠═c5b65438-f3a8-11ea-244c-f7ed186cef40
# ╠═30dd639a-f3b6-11ea-3700-2d2770333ac3
# ╠═3e1acca4-f397-11ea-075f-b9118034bd23
# ╠═f274ca9a-f3a8-11ea-210a-612a8d8ee463
# ╠═13a6459a-f3a9-11ea-26f2-554d6989f01e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment