Getting the length of a vector
Is there a way to get the length of a vector according to the form: For a vector (v_1,v_2,v_3, ... , v_n), get the result sqrt(v_1^2 + v_2^2 + v_3^2 + ... + v_n^2).
Is there a way to get the length of a vector according to the form: For a vector (v_1,v_2,v_3, ... , v_n), get the result sqrt(v_1^2 + v_2^2 + v_3^2 + ... + v_n^2).
You can use the norm
method:
sage: v = vector((3,4))
sage: v
(3, 4)
sage: v.norm()
5
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2017-11-26 22:52:01 +0100
Seen: 6,317 times
Last updated: Nov 26 '17
HowTo implement filter for multiprocessing module?
v4.5.2 Upgrade Breaks Notebook, "got EOF subprocess must have crashed..."
where to get python coding tutorial for beginners link PDF
What's the vector equivalent to Pythons list addition? `[1,2]+[3,4]=[1,2,3,4]`
When does 1/2=0 ? (python's integer division Vs Sage's exact fractions)