File:Runge phenomenon.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 720 × 720 pixels, file size: 24 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: The red curve is the Runge function.

    The blue curve is a 5th-order interpolating polynomial (using six equally spaced interpolating points). The green curve is a 9th-order interpolating polynomial (using ten equally spaced interpolating points).

    At the interpolating points, the error between the function and the interpolating polynomial is (by definition) zero. Between the interpolating points (especially in the region close to the endpoints 1 and −1), the error between the function and the interpolating polynomial gets worse for higher-order polynomials.
    Español: La curva roja es la función de Runge.

    La curva azul es un polinomio interpolante de orden 5 (usando seis puntos equiespaciados). La curva verde es un polinomio interpolante de orden 9 (usando diez puntos equiespaciados).

    A los puntos interpolantes el error entre la función y el polinomio interpolantes es cero (por definición). Entre estos puntos (especialmente cerca de los extremos 1 y -1) el error entre la función y el polinomio interpolante incrementa conforme el polinomio aumenta de orden.
    Date
    Source Own work
    Author Nicoguaro
    SVG development
    InfoField
     The SVG code is valid.
     This plot was created with Matplotlib, Python and SciPy
     This SVG plot uses the path text method.
    Source code
    InfoField

    Python code

    from __future__ import division
    import numpy as np
    import matplotlib.pyplot as plt
    from scipy.interpolate import lagrange
    from matplotlib import rcParams
    
    rcParams['font.family'] = 'serif'
    rcParams['font.size'] = 16
    
    def runge(x):
        return 1/(1 + 25*x**2)
    
    plt.figure(figsize=(8,8))
    npts = 201
    
    # Runge Function
    x_vec = np.linspace(-1, 1, npts)
    y_vec = runge(x_vec)
    plt.plot(x_vec, y_vec, lw=2, color='r')
    
    # Fifth degree polynomial
    pts_x = np.linspace(-1, 1, 6)
    pts_y = runge(pts_x)
    poly = lagrange(pts_x, pts_y)
    y_interp = poly(x_vec)
    plt.plot(x_vec, y_interp, lw=2, color='b')
    
    # Ninth degree polynomial
    pts_x = np.linspace(-1, 1, 10)
    pts_y = runge(pts_x)
    poly = lagrange(pts_x, pts_y)
    y_interp = poly(x_vec)
    plt.plot(x_vec, y_interp, lw=2, color='g') 
    
    plt.savefig("Runge_phenomenon.svg")
    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

    22 October 2015

    24,181 byte

    image/svg+xml

    0f2b58a406488f53519b2242883ba2d3ec292a88

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current00:40, 23 October 2015Thumbnail for version as of 00:40, 23 October 2015720 × 720 (24 KB)wikimediacommons>NicoguaroUser created page with UploadWizard

    There are no pages that use this file.