Created
May 13, 2021 01:07
-
-
Save genkuroki/02391712c086dd4e182f63db668a427f to your computer and use it in GitHub Desktop.
Julia Pluto example.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### A Pluto.jl notebook ### | |
# v0.14.5 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ 0154ab9a-bf31-476c-a2f1-985d8cbf9508 | |
using Plots | |
# ╔═╡ d2bddd28-1fff-48d5-8cb6-a59ad3275fda | |
using SymPy | |
# ╔═╡ 938e4cc1-55d3-4572-adb2-19ca57ddfb38 | |
using LinearAlgebra | |
# ╔═╡ e5d4ac60-b383-11eb-196d-c1a8185270a0 | |
M = [ | |
1 2 | |
3 4 | |
] | |
# ╔═╡ 2d049c4f-42f7-4149-a921-114cb4f70ef9 | |
z = [ | |
5 | |
6 | |
] | |
# ╔═╡ f351df8a-6885-4f4b-9ded-c40474a0396a | |
M*z | |
# ╔═╡ 3f151a47-bbd5-449b-9d2a-b26a2db5bac7 | |
f(x, y) = exp(-(x^2 + y^2)/2) | |
# ╔═╡ ec912f0c-536c-44b7-b4a3-de3ed063d3c2 | |
let | |
x = y = range(-3, 3; length=200) | |
P1 = surface(x, y, f; colorbar=false) | |
xs = ys = range(-3, 3; length=61) | |
P2 = wireframe(xs, ys, f) | |
P3 = heatmap(x, y, f) | |
P4 = contourf(x, y, f) | |
plot(P1, P2, P3, P4; size=(800, 600), layout=(2, 2)) | |
end | |
# ╔═╡ 5c0f8a5f-9d8e-488d-b80f-bb733f200bff | |
a, b, c, d, p, q, r, s, λ = symbols("a b c d p q r s λ") | |
# ╔═╡ bc6783c2-775d-4b8c-acd5-2670a4ddcda6 | |
A = [ | |
a b | |
c d | |
] | |
# ╔═╡ 41a8f06f-a0d0-4b30-85ce-070e9798621b | |
B = [ | |
p q | |
r s | |
] | |
# ╔═╡ f5e5bce5-d837-4c1c-84f9-2ad5a907f57e | |
C = A*B | |
# ╔═╡ 63472a6e-0ec0-4b41-8011-29ed3f14a1f0 | |
det(C) |> factor | |
# ╔═╡ 338fd52b-dfc0-460f-90f6-e7671f22208f | |
det(A)*det(B) | |
# ╔═╡ 93f70b66-bd89-4fa3-acc6-17be92880d26 | |
ϕ = det(λ*I - A) | |
# ╔═╡ a4c838a2-8a6c-4363-9a95-0dac750de132 | |
solve(ϕ, [λ]) | |
# ╔═╡ Cell order: | |
# ╠═e5d4ac60-b383-11eb-196d-c1a8185270a0 | |
# ╠═2d049c4f-42f7-4149-a921-114cb4f70ef9 | |
# ╠═f351df8a-6885-4f4b-9ded-c40474a0396a | |
# ╠═0154ab9a-bf31-476c-a2f1-985d8cbf9508 | |
# ╠═3f151a47-bbd5-449b-9d2a-b26a2db5bac7 | |
# ╠═ec912f0c-536c-44b7-b4a3-de3ed063d3c2 | |
# ╠═d2bddd28-1fff-48d5-8cb6-a59ad3275fda | |
# ╠═5c0f8a5f-9d8e-488d-b80f-bb733f200bff | |
# ╠═bc6783c2-775d-4b8c-acd5-2670a4ddcda6 | |
# ╠═41a8f06f-a0d0-4b30-85ce-070e9798621b | |
# ╠═f5e5bce5-d837-4c1c-84f9-2ad5a907f57e | |
# ╠═938e4cc1-55d3-4572-adb2-19ca57ddfb38 | |
# ╠═63472a6e-0ec0-4b41-8011-29ed3f14a1f0 | |
# ╠═338fd52b-dfc0-460f-90f6-e7671f22208f | |
# ╠═93f70b66-bd89-4fa3-acc6-17be92880d26 | |
# ╠═a4c838a2-8a6c-4363-9a95-0dac750de132 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment