Jump to content

File:Shooting method error.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 489 × 351 pixels, file size: 29 KB)

Summary

Description
English: Graph showing error of the shooting method as a function of the initial value of w'(0).
Español: Gráfico mostrando el error del método de disparo como una función del valor inicial para w'(0).
Date
Source Own work
Author Nicoguaro
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with Matplotlib.
Source code
InfoField

Python code

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

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

It plots the error for picking different initial values in the range
[-100, 0]. There are two (approximated) roots -36 and 8.
"""
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, 50)
diff_ini = np.linspace(-100, 0, 200)
err = np.zeros_like(diff_ini)
plt.figure(figsize=(6, 4))
for cont, dy in enumerate(diff_ini):
    y0 = [4, dy]    
    y = odeint(func, y0, t)
    err[cont] = y[-1, 0]

plt.hlines(0, -100, 0, linestyles="dashed", color="#3c3c3c",
           linewidth=1)
plt.plot(diff_ini, err)
plt.xlabel(r"$w'(0)=s$")
plt.ylabel(r"$w(t; s) - 1$")
plt.savefig("Shooting_method_error.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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

9 November 2016

29,655 byte

351 pixel

489 pixel

image/svg+xml

a0ace5110bd612d1c0ff9ba05cc6d0312778011b

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current00:07, 10 November 2016Thumbnail for version as of 00:07, 10 November 2016489 × 351 (29 KB)NicoguaroUser created page with UploadWizard

The following 2 pages use this file:

Metadata