.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\spherical_to_cartesian.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_spherical_to_cartesian.py: Spherical to Cartesian Conversion Example ========================================= Convert spherical coordinates (theta, phi) to Cartesian coordinates. .. GENERATED FROM PYTHON SOURCE LINES 7-25 .. rst-class:: sphx-glr-script-out .. code-block:: none Input spherical coordinates (theta, phi): [[0.78539816 1.04719755] [0.52359878 0.78539816]] Converted Cartesian coordinates (x, y, z): [[0.35355339 0.61237244 0.70710678] [0.35355339 0.35355339 0.8660254 ]] | .. code-block:: Python import numpy as np from spheresmooth import spherical_to_cartesian # Example spherical coordinates theta_phi = np.array([ [np.pi / 4, np.pi / 3], [np.pi / 6, np.pi / 4] ]) print("Input spherical coordinates (theta, phi):") print(theta_phi) # Convert to Cartesian cartesian = spherical_to_cartesian(theta_phi) print("\nConverted Cartesian coordinates (x, y, z):") print(cartesian) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.001 seconds) .. _sphx_glr_download_auto_examples_spherical_to_cartesian.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: spherical_to_cartesian.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: spherical_to_cartesian.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: spherical_to_cartesian.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_