Skip to content

Instantly share code, notes, and snippets.

@genkuroki
Created June 19, 2017 13:12
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 genkuroki/a71f8cb96a575865108bafc9ea929669 to your computer and use it in GitHub Desktop.
Save genkuroki/a71f8cb96a575865108bafc9ea929669 to your computer and use it in GitHub Desktop.
Julia/Plots Animation 2 in Julia.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "https://juliaplots.github.io/\n\nLorenz Attractor"
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "using Plots\npyplot()\n\n# initialize the attractor\nn = 1500\ndt = 0.02\nσ, ρ, β = 10., 28., 8/3\nx, y, z = 1., 1., 1.\n\n# initialize a 3D plot with 1 empty series\nplt = path3d(1, xlim=(-25,25), ylim=(-25,25), zlim=(0,50),\n xlab = \"x\", ylab = \"y\", zlab = \"z\",\n title = \"Lorenz Attractor\", marker = 1)\n\n# build an animated gif, saving every 10th frame\n@gif for i=1:n\n dx = σ*(y - x) ; x += dt * dx\n dy = x*(ρ - z) - y ; y += dt * dy\n dz = x*y - β*z ; z += dt * dz\n push!(plt, x, y, z)\nend every 10",
"execution_count": 1,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": "\u001b[1m\u001b[34mINFO: Saved animation to C:\\home\\kuroki\\Dropbox\\Jupyter\\Julia\\tmp.gif\n\u001b[0m"
},
{
"data": {
"text/html": "<img src=\"tmp.gif?0.1154538086297372>\" />",
"text/plain": "Plots.AnimatedGif(\"C:\\\\home\\\\kuroki\\\\Dropbox\\\\Jupyter\\\\Julia\\\\tmp.gif\")"
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"collapsed": true,
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"gist": {
"id": "",
"data": {
"description": "Julia/Plots Animation 2 in Julia.ipynb",
"public": true
}
},
"kernelspec": {
"name": "julia-0.5",
"display_name": "Julia 0.5.2",
"language": "julia"
},
"language_info": {
"file_extension": ".jl",
"name": "julia",
"mimetype": "application/julia",
"version": "0.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment