File:Instability of Euler's method.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this PNG preview of this SVG file: 720 × 540 pixels. Other resolutions: 320 × 240 pixels | 640 × 480 pixels | 1,024 × 768 pixels | 1,280 × 960 pixels | 2,560 × 1,920 pixels.
Original file (SVG file, nominally 720 × 540 pixels, file size: 23 KB)
File information
Structured data
Captions
Summary
[edit]DescriptionInstability of Euler's method.svg |
English: This graph shows that the instability of Euler's method when solving the equation . The black curve shows the exact solution, the blue squares the numerical approximation with step size , and the red circles the numerical solution with . |
Date | |
Source | Own work |
Author | Jitse Niesen |
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
Source code
[edit]import matplotlib.pyplot as plt
from numpy import linspace, exp
from math import floor
la = -2.3
end_time = 5
exact_times = linspace(0, end_time, 100)
exact_solution = exp(la * exact_times)
euler1_h = 1;
euler1_N = int(floor(end_time / euler1_h))
euler1_times = [ k * euler1_h for k in range(euler1_N + 1) ]
euler1_solution = [ (1 + euler1_h * la) ** k for k in range(euler1_N + 1) ]
euler2_h = 0.7;
euler2_N = int(floor(end_time / euler2_h))
euler2_times = [ k*euler2_h for k in range(euler2_N + 1) ]
euler2_solution = [ (1 + euler2_h * la) ** k for k in range(euler2_N + 1) ]
plt.plot(exact_times, exact_solution, '-k',
euler1_times, euler1_solution, ':sb',
euler2_times, euler2_solution, ':or', markersize = 10)
plt.gca().tick_params(labelsize = 20)
plt.savefig('euler-instability.svg')
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 17:02, 10 March 2012 | 720 × 540 (23 KB) | Jitse Niesen (talk | contribs) |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on el.wikipedia.org
- Usage on en.wikipedia.org
- Usage on mn.wikipedia.org
- Usage on vi.wikipedia.org
- Usage on zh-yue.wikipedia.org