Ask Your Question
1

Getting the length of a vector

asked 7 years ago

Poetastrophe gravatar image

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).

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 7 years ago

tmonteil gravatar image

You can use the norm method:

sage: v = vector((3,4))
sage: v
(3, 4)
sage: v.norm()
5
Preview: (hide)
link

Comments

1

Thank you a lot. Saved my life!

Poetastrophe gravatar imagePoetastrophe ( 7 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 7 years ago

Seen: 6,682 times

Last updated: Nov 26 '17