File:Contour plot of all solutions to Euler's equations.png

From testwiki
Jump to navigation Jump to search
    Original file (967 × 475 pixels, file size: 410 KB, MIME type: image/png)

    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: Given fixed angular momentum, for each value of kinetic energy, we have a family of curves for the possible value of angular velocity. The curves are plotted in black, on the orange ellipsoid of fixed angular momentum.

    ```python import numpy as np import matplotlib.pyplot as plt import scipy

    1. Adjustable parameters

    L = 1.0 L2 = L**2 I1, I2, I3 = 1.0, 2.0, 3.0 xmin, xmax, ymin, ymax, zmin, zmax = -L/I1, L/I1, -L/I2, L/I2, -L/I3, L/I3 E1, E2, E3 = 0.5*L2/I1, 0.5*L2/I2, 0.5*L2/I3

    def parametric_plot(E, orbit_res=1000):

       thetas = np.linspace(0, 2*np.pi, orbit_res)
       if E3 < E and E < E2:
           rs = np.zeros(orbit_res)
           zs = np.zeros(orbit_res)
           for i, theta in enumerate(thetas):
               invmatrix = scipy.linalg.inv(np.array([[I1 * np.cos(theta)**2 + I2 * np.sin(theta)**2    , I3],
                                                     [(I1 * np.cos(theta))**2 + (I2 * np.sin(theta))**2, I3**2]]))
               r2z2 = invmatrix @ np.array([[2*E], [L2]])
               rs[i] = np.sqrt(r2z2[0,0])
               zs[i] = np.sqrt(r2z2[1,0])
           return rs * np.cos(thetas), rs * np.sin(thetas), zs
       if E2 < E and E < E1:
           xs = np.zeros(orbit_res)
           rs = np.zeros(orbit_res)
           for i, theta in enumerate(thetas):
               invmatrix = scipy.linalg.inv(np.array([[I1, I2 * np.cos(theta)**2 + I3 * np.sin(theta)**2],
                                                     [I1, (I2 * np.cos(theta))**2 + (I3 * np.sin(theta))**2]]))
               x2r2 = invmatrix @ np.array([[2*E], [L2]])
               xs[i] = np.sqrt(x2r2[0,0])
               rs[i] = np.sqrt(x2r2[1,0])
           return xs, rs * np.cos(thetas), rs * np.sin(thetas)
    

    fig = plt.figure(figsize = (16,16)) ax = plt.axes(projection='3d')

    u = np.linspace(0, 2 * np.pi, 100) v = np.linspace(0, np.pi, 100) x = np.outer(np.cos(u), np.sin(v)) y = np.outer(np.sin(u), np.sin(v)) z = np.outer(np.ones(np.size(u)), np.cos(v)) x *= L/I1 y *= L/I2 z *= L/I3

    ax.plot_surface(x, y, z, color='orange', alpha=0.3)

    epsilon=1e-3 for E in np.linspace(E3+epsilon, E1-epsilon, 20):

       xs, ys, zs = parametric_plot(E)
       xs *= 1+epsilon
       ys *= 1+epsilon
       zs *= 1+epsilon
       ax.plot3D(xs, ys, zs, linewidth=1, color='k')
       ax.plot3D(-xs, -ys, -zs, linewidth=1, color='k')
    

    ax.axes.set_xlim3d(xmin, xmax) ax.axes.set_ylim3d(ymin, ymax) ax.axes.set_zlim3d(zmin, zmax)

    ax.set_aspect('equal') ax.set_axis_off()

    plt.show()

    ```
    Date
    Source Own work
    Author Cosmia Nebula

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 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.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    27 April 2023

    image/png

    3f70ffc7c31726752c9c0c8984e7988f129f6030

    420,129 byte

    475 pixel

    967 pixel

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current23:21, 27 April 2023Thumbnail for version as of 23:21, 27 April 2023967 × 475 (410 KB)wikimediacommons>Cosmia Nebulacropped

    There are no pages that use this file.