figshare
Browse

Python code to plot Cartesian surfaces

Download (5.95 kB)
Version 2 2020-01-29, 16:13
Version 1 2020-01-29, 15:46
software
posted on 2020-01-29, 16:13 authored by Alberto SilvaAlberto Silva, Rafael Torres
This code uses numpy and matplotlib Python libraries to plot full Cartesian surfaces. The quartic equation of a Cartesian surface is written as a third-order polynomial from which are obtained three solutions that are then visualized.

The code has been tested using Python 3.7.3. Inside the code, there are three functions corresponding to the Cartesian oval solutions identified by rho1, rho2, and rho3. the function get_quartic_surface surface receives as inputs the following parameters:
n_o - refractive index of the media before the surface
n_i - refractive index of the media after the surface
z_o - object position (z_o < 0 real object, otherwise virtual)
z_i - image position (z_i > 0 real image, otherwise virtual)
angles - an array of angles from 0 to pi (this is the angle that makes the rho parameter with the z-axis)

These parameters are defined inside the Python code and can be changed to try different configurations, passing them to the get_quartic_surface function that returns the values of rho solutions. The solutions can be used to acquire the Cartesian coordinates of the Cartesian surfaces.

History

Usage metrics

    Licence

    Exports

    RefWorks
    BibTeX
    Ref. manager
    Endnote
    DataCite
    NLM
    DC