benchmarks.wiki / Public workspace

SciCode / 29.1 / Provide a fucntion that normalizes the input vector. The input should be a numpy…

Problem

Answer published by the source. Consult the official source to check your work against its answer.

step background

Background The formula to normalize a vector vv using the L2 norm is: $$ \mathbf{v}^{\prime}=\frac{\mathbf{v}}{\|\mathbf{v}\|_2} $$ where v2=v12+v22++vN2\|\mathbf{v}\|_2=\sqrt{v_1^2+v_2^2+\ldots+v_N^2}.
Plain-text mathematical notation (without MathML)
Background

The formula to normalize a vector v using the L2 norm is:
$$
\mathbf{v}^{\prime}=\frac{\mathbf{v}}{\|\mathbf{v}\|_2}
$$
where ‖v‖₂=√(v₁²+v₂²+…+v_(N)²).
Original LaTeX notation
Background

The formula to normalize a vector $v$ using the L2 norm is:
$$
\mathbf{v}^{\prime}=\frac{\mathbf{v}}{\|\mathbf{v}\|_2}
$$
where $\|\mathbf{v}\|_2=\sqrt{v_1^2+v_2^2+\ldots+v_N^2}$.

step description prompt

Provide a fucntion that normalizes the input vector. The input should be a numpy array and the output should be a numpy array with the same shape.

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import