File:Gershgorin Disk Theorem Example.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 503 × 344 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: Gershgorin disk theorem example. This diagram shows the discs in yellow derived for the eigenvalues. The first two disks overlap and their union contains two eigenvalues. The third and fourth disks are disjoint from the others and contain one eigenvalue each.
    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

    import numpy as np
    import matplotlib.pyplot as plt
    
    # Graph setup
    yellow = "#e9eabb"
    blue = "#122a8c"
    gray = '#757575'
    plt.rcParams["text.color"] = gray
    plt.rcParams["font.size"] = 12
    plt.rcParams["xtick.color"] = gray
    plt.rcParams["ytick.color"] = gray
    plt.rcParams["axes.labelcolor"] = gray
    plt.rcParams["axes.edgecolor"] = gray
    plt.rcParams["axes.spines.right"] = False
    plt.rcParams["axes.spines.top"] = False
    
    
    A = np.array([
      [10, -1, 0, 1],
      [0.2, 8, 0.2, 0.2],
      [1, 1, 2, 1],
      [-1, -1, -1, -11]])
    vals = np.linalg.eigvals(A)
    fig = plt.figure(figsize=(6, 4))
    for cont, val in enumerate(vals):
        real = np.real(val)
        imag = np.imag(val)
        center = A[cont, cont]
        radius = sum(np.abs(A[cont, k]) for k in range(4) if k != cont)
        circle = plt.Circle((center, 0), radius, color=yellow)
        plt.plot(real, imag, color=blue, marker="x", linewidth=0)
        plt.gca().add_artist(circle)
    
    plt.legend(["Eigenvalues"], frameon=False)
    plt.xlabel("Real axis")
    plt.ylabel("Imaginary axis")
    plt.yticks([-10, -5, 0, 5, 10])
    plt.axis("image")
    plt.xlim(-15, 15)
    plt.ylim(-10, 10)
    plt.savefig("Gershgorin Disk Theorem Example.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

    Gershgorin disk theorem example.

    Items portrayed in this file

    depicts

    15 February 2019

    24,325 byte

    image/svg+xml

    b4cfb5026694413be1a2b67d909f81b1f4e04d0f

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current20:44, 15 February 2019Thumbnail for version as of 20:44, 15 February 2019503 × 344 (24 KB)wikimediacommons>NicoguaroUser created page with UploadWizard

    There are no pages that use this file.