Demo entry 6658496

get_vector

   

Submitted by Jinhee Park on Nov 07, 2017 at 06:10
Language: Python. Code size: 402 Bytes.

scalar = []

k = 0
while k < (len(matrix) - 1):
	scalar.append(math.hypot(x_sub[k], y_sub[k]))
	k = k + 1
# hypot return the Euclidean norm, sqrt(x*x, y*y) which is the lenght of the vector form
# get scalar

theta = []

l = 0

while l < (len(matrix) - 1):
	try:
		theta.append(math.atan2(-y_sub[l], x_sub[l]))
	except ZeroDivisionError as e:
		theta.append(0)
	l = l + 1
# get theta

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).