-
-
Save jxltom/e40cf9b9015502b21c65 to your computer and use it in GitHub Desktop.
Mathematica code that calculate the Lorenz attractor.
This file contains 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
Clear[Evaluate[Context[] <> "*"]]; | |
SetDirectory[NotebookDirectory[]]; | |
sigma = 10; | |
rho = 28; | |
beta = 8/3; | |
tMax = 50; | |
s = NDSolve[{x'[t] == sigma*(y[t] - x[t]), | |
y'[t] == x[t]*(rho - z[t]) - y[t], z'[t] == x[t]*y[t] - beta*z[t], | |
x[0] == 1, y[0] == 1, z[0] == 1}, {x, y, z}, {t, 0, tMax}, | |
AccuracyGoal -> 20, PrecisionGoal -> 20, WorkingPrecision -> 40, | |
MaxSteps -> Infinity, MaxStepSize -> 0.001] | |
data = Evaluate[{x[t], y[t], z[t]} /. s]; | |
ParametricPlot3D[data, {t, 0, tMax}, PlotRange -> All, | |
MaxRecursion -> 8] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment