Question: I have been trying to execute this code but it won't produce any output no matter what. I need to get the figures I am
I have been trying to execute this code but it won't produce any output no matter what. I need to get the figures I am trying to show down here:
import numpy as np
from scipy.integrate import solveivp
import matplotlib.pyplot as plt
# Parameters
sigma
r
b
# Lorenz system
def lorenzt state, reverseFalse:
x y z state
dxdt sigma y x
dydt x r z y
dzdt x y b z
return dxdtdydtdzdt if reverse else dxdt dydt dzdt
# Initial conditions for the unstable manifold of the origin
initialconditionso # Small perturbation
# Initial conditions for the stable manifolds
initialconditionscplus npsqrtb r npsqrtb r r initialconditionscminus npsqrtb r npsqrtb r r
# Time span for integration tspan teval nplinspacetspan tspan
# Solve the system for the unstable manifold of the origin
solutiono solveivplorenz tspan, initialconditionso tevalteval, methodRK # Solve the system for the stable manifold of Creverse time solutioncplus solveivplorenz tspan, initialconditionscplus, tevalteval, methodRK argsTrue
# Solve the system for the stable manifold of Creverse time
solutioncminus solveivplorenz tspan, initialconditionscminus, tevalteval, methodRK argsTrue
# Plot the results fig pltfigure
ax fig.addsubplot projectiond
axplotsolutionoy solutionoy solutionoy label'Unstable Manifold of O
axplotsolutioncplus.y solutioncplus.y solutioncplus.y label'Stable Manifold of C
axplotsolutioncminus.y solutioncminus.y solutioncminus.y label'Stable Manifold of C
axsetxlabelX
axsetylabelY
axsetzlabelZ
plttitleManifolds in the Lorenz System'
pltlegend
pltshow
import numpy as np
from scipy.integrate import solveivp
import matplotlib.pyplot as plt
# Parameters
sigma
r
b
# Lorenz system
def lorenzt state, reverseFalse:
x y z state
dxdt sigma y x
dydt xrz y
dzdt xy bz
return dxdtdydtdzdt if reverse else dxdt dydt dzdt
# Initial conditions for the unstable manifold of the origin
initialconditions # Small perturbation
# Initial conditions for the stable manifolds
initialconditionscplus npsqrtb r npsqrtb r r
initialconditionscminus npsqrtb r npsqrtb r r
# Time span for integration
tspan
teval nplinspacetspan tspan
# Solve the system for the unstable manifold of the origin
solution solveivplorenz tspan, initialconditionso tevalteval, methodRK
# Solve the system for the stable manifold of Creverse time
solutioncplus solveivplorenz tspan, initialconditionscplus, tevalteval, methodRK argsTrue
# Solve the system for the stable manifold of Creverse time
solutioncminus solveivplorenz tspan, initialconditionscminus, tevalteval, methodRK argsTrue
# Plot the results
fig pltfigure
ax fig.addsubplot projectiond
axplotsolutionoy solutionoy solutionoy label'Unstable Manifold of
axplotsolutioncplus.y solutioncplus.y solutioncplus.y label'stable Manifold of C
axplotsolutioncminus.y solutioncminus.y solutioncminus.y label'stable Manifold of C
axsetxlabelX
axsetylabelY
axsetzlabelZ
plttitleManifolds in the Lorenz System'
pltlegend
pltshow
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
