File:Shooting method trajectories.svg

Summary

Description
English: Graph showing trajectories of the shooting method for different values of the initial value of w'(0).
Español: Gráfico que muestra trayectorias del método de disparo para diferentes valores del valor inicial para w'(0).
Date
Source Own work
Author Nicoguaro
SVG development
InfoField
Source code
InfoField

Python code

# -*- coding: utf-8 -*-
"""
Illustrate the shooting method for the equation

    w'' = 3/2*w**2

The initial values picked for the first derivative are
w'(0) = s = [-40, -36, -10, -8, -7]
"""
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
import seaborn as sns

sns.set_style("white")


def func(y, t):
    return [y[1], 1.5*y[0]**2]


t = np.linspace(0, 1.1, 50)
diff_ini = [-40, -36, -10, -8, -7]
plt.figure(figsize=(6, 4))
for dy in diff_ini:
    y0 = [4, dy]    
    y = odeint(func, y0, t)
    plt.plot(t, y[:, 0], label=r"$s=%i$" % dy)

plt.plot(1, 1, "o", mfc="#3c3c3c")
plt.legend(loc="best")
plt.xlabel(r"$t$")
plt.ylabel(r"$w(t; s)$")
plt.savefig("Shooting_method_trajectories.svg", bbox_inches="tight")
plt.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 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.
Category:CC-BY-4.0#Shooting%20method%20trajectories.svgCategory:Self-published work
Category:Numerical analysis Category:Differential equations
Category:CC-BY-4.0 Category:Differential equations Category:Numerical analysis Category:Self-published work Category:Valid SVG created with Matplotlib code