Skip to content

Instantly share code, notes, and snippets.

@briochemc
Created September 8, 2020 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briochemc/e2fb7f558bd9a652f7e075aeb49cec2f to your computer and use it in GitHub Desktop.
Save briochemc/e2fb7f558bd9a652f7e075aeb49cec2f to your computer and use it in GitHub Desktop.
### A Pluto.jl notebook ###
# v0.11.12
using Markdown
using InteractiveUtils
# ╔═╡ a8657c36-f1b1-11ea-2d91-ffd1be275a14
begin
using WGLMakie
using AbstractPlotting
using AbstractPlotting.MakieLayout
using JSServe
using JSServe.DOM
using ForwardDiff
using LinearAlgebra
end
# ╔═╡ b69233d2-f1b1-11ea-1b33-e92338ad1a58
begin
fx(x,y) = 0.7 - cos((x-y-2)/2) * exp(-y^2/5)
fy(x,y) = tanh((x + y)/5)
f(x,y) = [fx(x,y), fy(x,y)]
f(x) = f(x[1], x[2])
Df(x) = ForwardDiff.jacobian(f, x)
xs = ys = range(-5, 5, length=50)
end
# ╔═╡ e9dfa956-f1b2-11ea-0d54-f3cf8fab2f40
begin
x₀_slider = JSServe.Slider(range(-5, 5, length=101))
y₀_slider = JSServe.Slider(range(-5, 5, length=101))
Chord_fun = map((x,y) -> ((a,b) -> Point2(Df([x,y]) \ -f(a,b))), x₀_slider, y₀_slider)
JSServe.with_session() do s, r
return DOM.div(x₀_slider, y₀_slider)
end
end
# ╔═╡ 25c913fe-f1b2-11ea-0871-131bb69cde36
begin
s2, l2 = layoutscene(resolution=(700,700))
ax5 = l2[1:2,1] = LAxis(s2, title="MWE")
spb = streamplot!(ax5, Chord_fun, xs, ys)
s2
end
# ╔═╡ Cell order:
# ╠═a8657c36-f1b1-11ea-2d91-ffd1be275a14
# ╠═b69233d2-f1b1-11ea-1b33-e92338ad1a58
# ╠═e9dfa956-f1b2-11ea-0d54-f3cf8fab2f40
# ╠═25c913fe-f1b2-11ea-0871-131bb69cde36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment