File:Hyperbolic flow example, illustrating stable and unstable manifolds.png

Summary

Description
English: ```python

import numpy as np import matplotlib.pyplot as plt

  1. Define the vector field

def f(x, y):

   return np.array([x + np.exp(-y), -y])
  1. Define the domain

xmin, xmax, ymin, ymax = -1.7, -0.5, -1, 1

  1. Define the grid

nx, ny = 80, 80 x = np.linspace(xmin, xmax, nx) y = np.linspace(ymin, ymax, ny) X, Y = np.meshgrid(x, y)

  1. Evaluate the vector field on the grid

U, V = f(X, Y)

  1. Plot the vector field

fig, ax = plt.subplots(figsize=(8, 8)) ax.set_xlim(xmin, xmax) ax.set_ylim(ymin, ymax)

  1. Plot the integral curves

x0, y0 = np.meshgrid(np.linspace(-2, 0, 40), np.linspace(-1, 1, 40)) t = np.linspace(0, 5, 100) for i in range(x0.shape[0]):

   for j in range(x0.shape[1]):
       x, y = x0[i,j], y0[i,j]
       sol = np.zeros((2, t.size))
       sol[:,0] = [x, y]
       for k in range(1, t.size):
           sol[:,k] = sol[:,k-1] + f(sol[0,k-1], sol[1,k-1])*(t[k]-t[k-1])
       ax.plot(sol[0,:], sol[1,:], 'b-', linewidth=1, alpha=0.1)

plt.show()

```
Date
Source Own work
Author Cosmia Nebula

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#Hyperbolic%20flow%20example,%20illustrating%20stable%20and%20unstable%20manifolds.png
Category:Self-published work Category:Hyperbolas Category:Mathematical manifolds Category:Dynamical systems Category:Images with Python source code
Category:CC-BY-SA-4.0 Category:Dynamical systems Category:Hyperbolas Category:Images with Python source code Category:Mathematical manifolds Category:Self-published work