.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\norm2.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_norm2.py: L2 Norm Example =============== Compute the L2 (Euclidean) norm of a vector. .. GENERATED FROM PYTHON SOURCE LINES 7-22 .. rst-class:: sphx-glr-script-out .. code-block:: none Input vector: u = [1. 2. 3.] L2 norm norm2(u): 3.7416573867739413 | .. code-block:: Python import numpy as np from spheresmooth import norm2 # Example vector u = np.array([1.0, 2.0, 3.0]) print("Input vector:") print("u =", u) # Compute L2 norm value = norm2(u) print("\nL2 norm norm2(u):") print(value) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.003 seconds) .. _sphx_glr_download_auto_examples_norm2.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: norm2.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: norm2.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: norm2.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_