Skip to content

Instantly share code, notes, and snippets.

@simonbyrne
Last active October 24, 2018 05: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 simonbyrne/d077ea61cd3773fa2a0849414c76215c to your computer and use it in GitHub Desktop.
Save simonbyrne/d077ea61cd3773fa2a0849414c76215c to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[BinDeps]]
deps = ["Compat", "Libdl", "SHA", "URIParser"]
git-tree-sha1 = "12093ca6cdd0ee547c39b1870e0c9c3f154d9ca9"
uuid = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
version = "0.8.10"
[[BinaryProvider]]
deps = ["Libdl", "Pkg", "SHA", "Test"]
git-tree-sha1 = "9930c1a6cd49d9fcd7218df6be417e6ae4f1468a"
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
version = "0.5.2"
[[ColorTypes]]
deps = ["FixedPointNumbers", "Random", "Test"]
git-tree-sha1 = "f73b0e10f2a5756de7019818a41654686da06b09"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.7.5"
[[Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "InteractiveUtils", "Pkg", "Printf", "Reexport", "Test"]
git-tree-sha1 = "8c89e0a9a583954eae3efcf6a531e51c02b38cee"
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
version = "0.9.4"
[[CommonSubexpressions]]
deps = ["Test"]
git-tree-sha1 = "efdaf19ab11c7889334ca247ff4c9f7c322817b0"
uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
version = "0.2.0"
[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "2d9e14d19bad3f9ad5cc5e4cffabc3cfa59de825"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "1.3.0"
[[Conda]]
deps = ["Compat", "JSON", "VersionParsing"]
git-tree-sha1 = "fb86fe40cb5b35990e368709bfdc1b46dbb99dac"
uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d"
version = "1.1.1"
[[Contour]]
deps = ["LinearAlgebra", "StaticArrays", "Test"]
git-tree-sha1 = "b974e164358fea753ef853ce7bad97afec15bb80"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
version = "0.5.1"
[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections", "REPL", "Random", "Serialization", "Test"]
git-tree-sha1 = "8fc6e166e24fda04b2b648d4260cdad241788c54"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.14.0"
[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[DelimitedFiles]]
deps = ["Mmap"]
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
[[DiffResults]]
deps = ["Compat", "StaticArrays"]
git-tree-sha1 = "db8acf46717b13d6c48deb7a12007c7f85a70cf7"
uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
version = "0.0.3"
[[DiffRules]]
deps = ["Random", "Test"]
git-tree-sha1 = "c49ec69428ffea0c1d1bbdc63d1a70f5df5860ad"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "0.0.7"
[[Distributed]]
deps = ["LinearAlgebra", "Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
[[FixedPointNumbers]]
deps = ["Pkg", "Test"]
git-tree-sha1 = "b8045033701c3b10bf2324d7203404be7aef88ba"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.5.3"
[[ForwardDiff]]
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "InteractiveUtils", "LinearAlgebra", "NaNMath", "Pkg", "Random", "SparseArrays", "SpecialFunctions", "StaticArrays", "Test"]
git-tree-sha1 = "d8f3e0f19d0d546aa92eb1cd67cd3e515768d9f7"
uuid = "f6369f11-7733-5829-9624-2563aa707210"
version = "0.10.0"
[[GR]]
deps = ["Base64", "DelimitedFiles", "Pkg", "Random", "Serialization", "Sockets", "Test"]
git-tree-sha1 = "18e3aa0f988f6e94c90394deaa76cb095bf87469"
uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
version = "0.35.0"
[[IJulia]]
deps = ["Base64", "Compat", "Conda", "Dates", "InteractiveUtils", "JSON", "Markdown", "MbedTLS", "Pkg", "Printf", "REPL", "Random", "SoftGlobalScope", "Test", "UUIDs", "ZMQ"]
git-tree-sha1 = "7545d05fa0253aef6cc0728fddae44e6837619c8"
uuid = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
version = "1.13.0"
[[InteractiveUtils]]
deps = ["LinearAlgebra", "Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[JSON]]
deps = ["Dates", "Distributed", "Mmap", "Pkg", "Sockets", "Test", "Unicode"]
git-tree-sha1 = "fec8e4d433072731466d37ed0061b3ba7f70eeb9"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.19.0"
[[LibGit2]]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[MbedTLS]]
deps = ["BinaryProvider", "Libdl", "Pkg", "Random", "Sockets", "Test"]
git-tree-sha1 = "4b890362c0c2fdb14a575ce927f1f4eeac6dda9f"
uuid = "739be429-bea8-5141-9913-cc70e7f3736d"
version = "0.6.4"
[[Measures]]
deps = ["Pkg", "Test"]
git-tree-sha1 = "ddfd6d13e330beacdde2c80de27c1c671945e7d9"
uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
version = "0.3.0"
[[Missings]]
deps = ["Dates", "InteractiveUtils", "SparseArrays", "Test"]
git-tree-sha1 = "adc26d2ee85a49c413464110d922cf21efc9d233"
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
version = "0.3.1"
[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[NaNMath]]
deps = ["Compat"]
git-tree-sha1 = "ce3b85e484a5d4c71dd5316215069311135fa9f2"
uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "0.3.2"
[[OrderedCollections]]
deps = ["Pkg", "Random", "Serialization", "Test"]
git-tree-sha1 = "85619a3f3e17bb4761fe1b1fd47f0e979f964d5b"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.0.2"
[[Pkg]]
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
[[PlotThemes]]
deps = ["PlotUtils", "Requires", "Test"]
git-tree-sha1 = "f3afd2d58e1f6ac9be2cea46e4a9083ccc1d990b"
uuid = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a"
version = "0.3.0"
[[PlotUtils]]
deps = ["Colors", "Dates", "Printf", "Random", "Reexport", "Test"]
git-tree-sha1 = "fd28f30a294a38ec847de95d8ac7ac916ccd7c06"
uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043"
version = "0.5.5"
[[Plots]]
deps = ["Base64", "Contour", "Dates", "FixedPointNumbers", "GR", "JSON", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "Printf", "Random", "RecipesBase", "Reexport", "Requires", "Showoff", "SparseArrays", "StaticArrays", "Statistics", "StatsBase", "Test", "UUIDs"]
git-tree-sha1 = "83f387a4989ab60dfb0bb3f52f3907a14acc1588"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
version = "0.20.6"
[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[RecipesBase]]
deps = ["Pkg", "Random", "Test"]
git-tree-sha1 = "0b3cb370ee4dc00f47f1193101600949f3dcf884"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "0.6.0"
[[Reexport]]
deps = ["Pkg"]
git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "0.2.0"
[[Requires]]
deps = ["Test"]
git-tree-sha1 = "f6fbf4ba64d295e146e49e021207993b6b48c7d1"
uuid = "ae029012-a4dd-5104-9daa-d747884805df"
version = "0.5.2"
[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
[[Showoff]]
deps = ["Compat", "Pkg"]
git-tree-sha1 = "276b24f3ace98bec911be7ff2928d497dc759085"
uuid = "992d4aef-0814-514b-bc4d-f2e9a6c4116f"
version = "0.2.1"
[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[SoftGlobalScope]]
deps = ["Test"]
git-tree-sha1 = "97f6dfcf612b9a7260fde44170725d9ea34b1431"
uuid = "b85f4697-e234-5449-a836-ec8e2f98b302"
version = "1.0.7"
[[SortingAlgorithms]]
deps = ["DataStructures", "Random", "Test"]
git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "0.3.1"
[[SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[SpecialFunctions]]
deps = ["BinDeps", "BinaryProvider", "Libdl", "Test"]
git-tree-sha1 = "c35c9c76008babf4d658060fc64aeb369a41e7bd"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "0.7.1"
[[StaticArrays]]
deps = ["InteractiveUtils", "LinearAlgebra", "Random", "Statistics", "Test"]
git-tree-sha1 = "d432c79bef174a830304f8601427a4357dfdbfb7"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "0.8.3"
[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[StatsBase]]
deps = ["DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "Test"]
git-tree-sha1 = "723193a13e8078cec6dcd0b8fe245c8bfd81690e"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.25.0"
[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[URIParser]]
deps = ["Test", "Unicode"]
git-tree-sha1 = "6ddf8244220dfda2f17539fa8c9de20d6c575b69"
uuid = "30578b45-9adc-5946-b283-645ec420af67"
version = "0.4.0"
[[UUIDs]]
deps = ["Random"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[VersionParsing]]
deps = ["Compat"]
git-tree-sha1 = "c9d5aa108588b978bd859554660c8a5c4f2f7669"
uuid = "81def892-9a0e-5fdd-b105-ffc91e053289"
version = "1.1.3"
[[ZMQ]]
deps = ["BinaryProvider", "FileWatching", "Libdl", "Sockets", "Test"]
git-tree-sha1 = "34e7ac2d1d59d19d0e86bde99f1f02262bfa1613"
uuid = "c2297ded-f4af-51ae-bb23-16f91089e4e1"
version = "1.0.0"
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"using LinearAlgebra, Printf, Statistics, ForwardDiff"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"path2 (generic function with 5 methods)"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function path2(logπ, M, T=100, ϵ=0.01, x=[sqrt(1/2), sqrt(1/2)], z=[1,0])\n",
" E = zeros(T)\n",
" \n",
" tol = sqrt(eps())\n",
" \n",
" Π = I - x*x'\n",
" A = Π * M * Π\n",
"\n",
" Λ,U = eigen(A)\n",
" Λ = [abs(λ) < tol ? 0.0 : λ for λ in Λ]\n",
" invΛ = [abs(λ) < tol ? 0.0 : 1/λ for λ in Λ]\n",
"\n",
" A⁺ = U*Diagonal(invΛ)*U'\n",
" v = U * (sqrt.(invΛ).*z)\n",
"\n",
" e = -logπ(x) + v'*A*v/2\n",
"\n",
" for t = 1:T\n",
" # 5\n",
" v += ϵ/2 * A⁺ * (ForwardDiff.gradient(logπ, x) + A⁺*(Π*M*x))\n",
" # 6\n",
" vv = U * Diagonal(sqrt.(Λ)) * U' * v\n",
" # 7\n",
" α = norm(vv)\n",
" nvv = vv / α \n",
" x,nvv = cos(α*ϵ)*x+sin(α*ϵ)*nvv, -sin(α*ϵ)*x+cos(α*ϵ)*nvv\n",
" vv = nvv * α\n",
"\n",
" # recompute quantities\n",
" Π = I - x*x'\n",
" A = Π * M * Π\n",
"\n",
" Λ,U = eigen(A)\n",
" Λ = [abs(λ) < tol ? 0.0 : λ for λ in Λ]\n",
" invΛ = [abs(λ) < tol ? 0.0 : 1/λ for λ in Λ]\n",
"\n",
" A⁺ = U*Diagonal(invΛ)*U'\n",
"\n",
" # 8\n",
" v = U * Diagonal(sqrt.(invΛ)) * U' * vv\n",
" # 9\n",
" v += ϵ/2 * A⁺ * ( +A⁺*(Π*M*x))\n",
"\n",
" ee = -logπ(x) + v'*A*v/2\n",
" E[t] = e-ee\n",
" end\n",
" E\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"using Plots"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
"<defs>\n",
" <clipPath id=\"clip9200\">\n",
" <rect x=\"0\" y=\"0\" width=\"2000\" height=\"2000\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<defs>\n",
" <clipPath id=\"clip9201\">\n",
" <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polygon clip-path=\"url(#clip9201)\" points=\"\n",
"0,1600 2400,1600 2400,0 0,0 \n",
" \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip9202\">\n",
" <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polygon clip-path=\"url(#clip9201)\" points=\"\n",
"189.504,1503.47 2321.26,1503.47 2321.26,47.2441 189.504,47.2441 \n",
" \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip9203\">\n",
" <rect x=\"189\" y=\"47\" width=\"2133\" height=\"1457\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 244.797,1503.47 244.797,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 748.829,1503.47 748.829,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1252.86,1503.47 1252.86,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1756.89,1503.47 1756.89,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 2260.93,1503.47 2260.93,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 189.504,1209.88 2321.26,1209.88 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 189.504,836.069 2321.26,836.069 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 189.504,462.261 2321.26,462.261 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 189.504,88.453 2321.26,88.453 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 189.504,1503.47 2321.26,1503.47 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 189.504,1503.47 189.504,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 244.797,1503.47 244.797,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 748.829,1503.47 748.829,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1252.86,1503.47 1252.86,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1756.89,1503.47 1756.89,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 2260.93,1503.47 2260.93,1481.63 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 189.504,1209.88 221.48,1209.88 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 189.504,836.069 221.48,836.069 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 189.504,462.261 221.48,462.261 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 189.504,88.453 221.48,88.453 \n",
" \"/>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 244.797, 1557.47)\" x=\"244.797\" y=\"1557.47\">0</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 748.829, 1557.47)\" x=\"748.829\" y=\"1557.47\">1</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1252.86, 1557.47)\" x=\"1252.86\" y=\"1557.47\">2</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1756.89, 1557.47)\" x=\"1756.89\" y=\"1557.47\">3</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 2260.93, 1557.47)\" x=\"2260.93\" y=\"1557.47\">4</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 165.504, 1227.38)\" x=\"165.504\" y=\"1227.38\">-0.3</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 165.504, 853.569)\" x=\"165.504\" y=\"853.569\">-0.2</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 165.504, 479.761)\" x=\"165.504\" y=\"479.761\">-0.1</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 165.504, 105.953)\" x=\"165.504\" y=\"105.953\">0.0</text>\n",
"</g>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 249.837,88.4799 254.877,88.5607 259.917,88.6953 264.958,88.8838 269.998,89.1263 275.038,89.4227 280.079,89.7733 285.119,90.1781 290.159,90.6371 295.2,91.1506 \n",
" 300.24,91.7187 305.28,92.3414 310.321,93.0191 315.361,93.7519 320.401,94.5399 325.442,95.3834 330.482,96.2827 335.522,97.2379 340.563,98.2494 345.603,99.3174 \n",
" 350.643,100.442 355.684,101.624 360.724,102.864 365.764,104.161 370.805,105.516 375.845,106.93 380.885,108.403 385.926,109.935 390.966,111.526 396.006,113.179 \n",
" 401.047,114.891 406.087,116.665 411.127,118.5 416.168,120.398 421.208,122.358 426.248,124.382 431.289,126.469 436.329,128.62 441.369,130.837 446.41,133.119 \n",
" 451.45,135.468 456.49,137.883 461.531,140.366 466.571,142.917 471.611,145.537 476.652,148.227 481.692,150.987 486.732,153.819 491.773,156.723 496.813,159.7 \n",
" 501.853,162.75 506.893,165.875 511.934,169.076 516.974,172.353 522.014,175.708 527.055,179.141 532.095,182.654 537.135,186.246 542.176,189.92 547.216,193.677 \n",
" 552.256,197.517 557.297,201.442 562.337,205.453 567.377,209.55 572.418,213.736 577.458,218.011 582.498,222.377 587.539,226.834 592.579,231.385 597.619,236.03 \n",
" 602.66,240.771 607.7,245.609 612.74,250.545 617.781,255.582 622.821,260.72 627.861,265.961 632.902,271.307 637.942,276.759 642.982,282.318 648.023,287.986 \n",
" 653.063,293.765 658.103,299.657 663.144,305.663 668.184,311.784 673.224,318.023 678.265,324.381 683.305,330.861 688.345,337.463 693.386,344.19 698.426,351.044 \n",
" 703.466,358.026 708.507,365.139 713.547,372.384 718.587,379.763 723.628,387.278 728.668,394.931 733.708,402.725 738.749,410.66 743.789,418.74 748.829,426.966 \n",
" 753.869,435.34 758.91,443.864 763.95,452.54 768.99,461.371 774.031,470.358 779.071,479.503 784.111,488.808 789.152,498.275 794.192,507.907 799.232,517.704 \n",
" 804.273,527.669 809.313,537.803 814.353,548.109 819.394,558.588 824.434,569.241 829.474,580.07 834.515,591.077 839.555,602.262 844.595,613.627 849.636,625.174 \n",
" 854.676,636.902 859.716,648.813 864.757,660.908 869.797,673.186 874.837,685.648 879.878,698.294 884.918,711.124 889.958,724.137 894.999,737.332 900.039,750.708 \n",
" 905.079,764.263 910.12,777.997 915.16,791.906 920.2,805.988 925.241,820.24 930.281,834.658 935.321,849.238 940.362,863.975 945.402,878.865 950.442,893.901 \n",
" 955.483,909.077 960.523,924.385 965.563,939.818 970.604,955.366 975.644,971.021 980.684,986.772 985.725,1002.61 990.765,1018.51 995.805,1034.48 1000.85,1050.49 \n",
" 1005.89,1066.53 1010.93,1082.59 1015.97,1098.64 1021.01,1114.67 1026.05,1130.66 1031.09,1146.58 1036.13,1162.42 1041.17,1178.16 1046.21,1193.76 1051.25,1209.21 \n",
" 1056.29,1224.47 1061.33,1239.53 1066.37,1254.35 1071.41,1268.9 1076.45,1283.16 1081.49,1297.09 1086.53,1310.67 1091.57,1323.86 1096.61,1336.64 1101.65,1348.96 \n",
" 1106.69,1360.8 1111.73,1372.13 1116.77,1382.91 1121.81,1393.12 1126.85,1402.73 1131.89,1411.71 1136.93,1420.02 1141.97,1427.66 1147.01,1434.58 1152.06,1440.77 \n",
" 1157.1,1446.22 1162.14,1450.89 1167.18,1454.78 1172.22,1457.87 1177.26,1460.15 1182.3,1461.62 1187.34,1462.26 1192.38,1462.08 1197.42,1461.08 1202.46,1459.25 \n",
" 1207.5,1456.62 1212.54,1453.18 1217.58,1448.94 1222.62,1443.93 1227.66,1438.16 1232.7,1431.64 1237.74,1424.41 1242.78,1416.47 1247.82,1407.86 1252.86,1398.61 \n",
" 1257.9,1388.73 1262.94,1378.27 1267.98,1367.24 1273.02,1355.68 1278.06,1343.63 1283.1,1331.11 1288.14,1318.15 1293.18,1304.78 1298.22,1291.05 1303.27,1276.97 \n",
" 1308.31,1262.58 1313.35,1247.9 1318.39,1232.98 1323.43,1217.82 1328.47,1202.48 1333.51,1186.96 1338.55,1171.29 1343.59,1155.51 1348.63,1139.63 1353.67,1123.68 \n",
" 1358.71,1107.67 1363.75,1091.63 1368.79,1075.57 1373.83,1059.52 1378.87,1043.49 1383.91,1027.5 1388.95,1011.55 1393.99,995.676 1399.03,979.876 1404.07,964.166 \n",
" 1409.11,948.557 1414.15,933.058 1419.19,917.678 1424.23,902.427 1429.27,887.312 1434.31,872.339 1439.35,857.515 1444.39,842.846 1449.43,828.336 1454.47,813.99 \n",
" 1459.52,799.812 1464.56,785.806 1469.6,771.973 1474.64,758.317 1479.68,744.839 1484.72,731.542 1489.76,718.427 1494.8,705.494 1499.84,692.744 1504.88,680.179 \n",
" 1509.92,667.797 1514.96,655.599 1520,643.585 1525.04,631.754 1530.08,620.105 1535.12,608.638 1540.16,597.351 1545.2,586.244 1550.24,575.315 1555.28,564.563 \n",
" 1560.32,553.986 1565.36,543.583 1570.4,533.353 1575.44,523.293 1580.48,513.401 1585.52,503.677 1590.56,494.117 1595.6,484.721 1600.64,475.486 1605.68,466.411 \n",
" 1610.73,457.492 1615.77,448.729 1620.81,440.12 1625.85,431.661 1630.89,423.352 1635.93,415.191 1640.97,407.174 1646.01,399.301 1651.05,391.569 1656.09,383.976 \n",
" 1661.13,376.521 1666.17,369.201 1671.21,362.014 1676.25,354.959 1681.29,348.033 1686.33,341.235 1691.37,334.562 1696.41,328.014 1701.45,321.588 1706.49,315.282 \n",
" 1711.53,309.094 1716.57,303.023 1721.61,297.068 1726.65,291.226 1731.69,285.495 1736.73,279.875 1741.77,274.363 1746.81,268.958 1751.85,263.658 1756.89,258.462 \n",
" 1761.93,253.368 1766.98,248.376 1772.02,243.482 1777.06,238.687 1782.1,233.988 1787.14,229.384 1792.18,224.874 1797.22,220.457 1802.26,216.131 1807.3,211.895 \n",
" 1812.34,207.748 1817.38,203.689 1822.42,199.716 1827.46,195.828 1832.5,192.025 1837.54,188.304 1842.58,184.666 1847.62,181.109 1852.66,177.631 1857.7,174.232 \n",
" 1862.74,170.912 1867.78,167.668 1872.82,164.5 1877.86,161.408 1882.9,158.39 1887.94,155.445 1892.98,152.573 1898.02,149.772 1903.06,147.043 1908.1,144.383 \n",
" 1913.14,141.793 1918.18,139.272 1923.23,136.819 1928.27,134.433 1933.31,132.114 1938.35,129.86 1943.39,127.672 1948.43,125.549 1953.47,123.489 1958.51,121.494 \n",
" 1963.55,119.561 1968.59,117.691 1973.63,115.882 1978.67,114.135 1983.71,112.449 1988.75,110.823 1993.79,109.258 1998.83,107.752 2003.87,106.305 2008.91,104.916 \n",
" 2013.95,103.587 2018.99,102.315 2024.03,101.101 2029.07,99.9436 2034.11,98.8437 2039.15,97.8004 2044.19,96.8135 2049.23,95.8828 2054.27,95.0079 2059.31,94.1887 \n",
" 2064.35,93.4248 2069.39,92.7162 2074.44,92.0625 2079.48,91.4637 2084.52,90.9195 2089.56,90.4298 2094.6,89.9945 2099.64,89.6134 2104.68,89.2865 2109.72,89.0137 \n",
" 2114.76,88.7948 2119.8,88.6298 2124.84,88.5188 2129.88,88.4616 2134.92,88.4582 2139.96,88.5086 2145,88.6129 2150.04,88.7711 2155.08,88.9831 2160.12,89.2492 \n",
" 2165.16,89.5693 2170.2,89.9435 2175.24,90.372 2180.28,90.8549 2185.32,91.3922 2190.36,91.9841 2195.4,92.6309 2200.44,93.3326 2205.48,94.0895 2210.52,94.9017 \n",
" 2215.56,95.7696 2220.6,96.6933 2225.64,97.6731 2230.69,98.7092 2235.73,99.802 2240.77,100.952 2245.81,102.159 2250.85,103.423 2255.89,104.746 2260.93,106.127 \n",
" \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9203)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 254.877,88.5607 264.958,88.8838 275.038,89.4228 285.119,90.1781 295.2,91.1507 305.28,92.3416 315.361,93.7521 325.442,95.3837 335.522,97.2382 345.603,99.3178 \n",
" 355.684,101.625 365.764,104.161 375.845,106.93 385.926,109.935 396.006,113.179 406.087,116.666 416.168,120.399 426.248,124.383 436.329,128.622 446.41,133.121 \n",
" 456.49,137.885 466.571,142.919 476.652,148.229 486.732,153.821 496.813,159.702 506.893,165.878 516.974,172.356 527.055,179.144 537.135,186.25 547.216,193.681 \n",
" 557.297,201.446 567.377,209.554 577.458,218.015 587.539,226.839 597.619,236.035 607.7,245.614 617.781,255.588 627.861,265.967 637.942,276.765 648.023,287.993 \n",
" 658.103,299.664 668.184,311.791 678.265,324.389 688.345,337.471 698.426,351.053 708.507,365.148 718.587,379.772 728.668,394.941 738.749,410.67 748.829,426.976 \n",
" 758.91,443.875 768.99,461.382 779.071,479.514 789.152,498.287 799.232,517.715 809.313,537.815 819.394,558.599 829.474,580.081 839.555,602.273 849.636,625.185 \n",
" 859.716,648.824 869.797,673.196 879.878,698.303 889.958,724.145 900.039,750.715 910.12,778.002 920.2,805.992 930.281,834.659 940.362,863.974 950.442,893.896 \n",
" 960.523,924.376 970.604,955.353 980.684,986.754 990.765,1018.49 1000.85,1050.46 1010.93,1082.55 1021.01,1114.62 1031.09,1146.53 1041.17,1178.09 1051.25,1209.13 \n",
" 1061.33,1239.44 1071.41,1268.8 1081.49,1296.98 1091.57,1323.74 1101.65,1348.82 1111.73,1371.98 1121.81,1392.96 1131.89,1411.53 1141.97,1427.47 1152.06,1440.58 \n",
" 1162.14,1450.69 1172.22,1457.66 1182.3,1461.41 1192.38,1461.87 1202.46,1459.04 1212.54,1452.97 1222.62,1443.73 1232.7,1431.44 1242.78,1416.28 1252.86,1398.42 \n",
" 1262.94,1378.09 1273.02,1355.52 1283.1,1330.95 1293.18,1304.64 1303.27,1276.84 1313.35,1247.78 1323.43,1217.72 1333.51,1186.86 1343.59,1155.42 1353.67,1123.6 \n",
" 1363.75,1091.56 1373.83,1059.46 1383.91,1027.44 1393.99,995.626 1404.07,964.122 1414.15,933.018 1424.23,902.392 1434.31,872.308 1444.39,842.819 1454.47,813.966 \n",
" 1464.56,785.784 1474.64,758.297 1484.72,731.525 1494.8,705.478 1504.88,680.165 1514.96,655.587 1525.04,631.742 1535.12,608.627 1545.2,586.235 1555.28,564.554 \n",
" 1565.36,543.575 1575.44,523.285 1585.52,503.67 1595.6,484.715 1605.68,466.404 1615.77,448.723 1625.85,431.656 1635.93,415.185 1646.01,399.296 1656.09,383.971 \n",
" 1666.17,369.196 1676.25,354.954 1686.33,341.23 1696.41,328.009 1706.49,315.277 1716.57,303.019 1726.65,291.221 1736.73,279.871 1746.81,268.954 1756.89,258.458 \n",
" 1766.98,248.372 1777.06,238.683 1787.14,229.38 1797.22,220.453 1807.3,211.892 1817.38,203.685 1827.46,195.825 1837.54,188.301 1847.62,181.105 1857.7,174.229 \n",
" 1867.78,167.665 1877.86,161.405 1887.94,155.442 1898.02,149.769 1908.1,144.38 1918.18,139.269 1928.27,134.43 1938.35,129.857 1948.43,125.546 1958.51,121.491 \n",
" 1968.59,117.688 1978.67,114.133 1988.75,110.821 1998.83,107.749 2008.91,104.914 2018.99,102.313 2029.07,99.9418 2039.15,97.7988 2049.23,95.8813 2059.31,94.1874 \n",
" 2069.39,92.715 2079.48,91.4627 2089.56,90.429 2099.64,89.6128 2109.72,89.0132 2119.8,88.6296 2129.88,88.4615 2139.96,88.5088 2150.04,88.7714 2160.12,89.2498 \n",
" 2170.2,89.9444 2180.28,90.8559 2190.36,91.9854 2200.44,93.3342 2210.52,94.9036 2220.6,96.6954 2230.69,98.7116 2240.77,100.954 2250.85,103.426 2260.93,106.13 \n",
" \n",
" \"/>\n",
"<polygon clip-path=\"url(#clip9201)\" points=\"\n",
"1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 \n",
" \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1958.43,312.204 2249.26,312.204 2249.26,130.764 1958.43,130.764 1958.43,312.204 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1982.43,191.244 2126.43,191.244 \n",
" \"/>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2150.43, 208.744)\" x=\"2150.43\" y=\"208.744\">y1</text>\n",
"</g>\n",
"<polyline clip-path=\"url(#clip9201)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1982.43,251.724 2126.43,251.724 \n",
" \"/>\n",
"<g clip-path=\"url(#clip9201)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2150.43, 269.224)\" x=\"2150.43\" y=\"269.224\">y2</text>\n",
"</g>\n",
"</svg>\n"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"T = 400; ϵ = 0.01\n",
"E = path2(x->0.0, [1.0 0.0; 0.0 4.0],T, ϵ)\n",
"p = plot((1:T)*ϵ, E)\n",
"\n",
"T = 200; ϵ = 0.02\n",
"E = path2(x->0.0, [1.0 0.0; 0.0 4.0],T, ϵ)\n",
"plot!(p, (1:T)*ϵ, E)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.0.1",
"language": "julia",
"name": "julia-1.0"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.0.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment