L2 Norm Example#

Compute the L2 (Euclidean) norm of a vector.

Input vector:
u = [1. 2. 3.]

L2 norm norm2(u):
3.7416573867739413

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)

Total running time of the script: (0 minutes 0.003 seconds)

Gallery generated by Sphinx-Gallery