""" 2d matrix for XY graph analysis matrix_xy_stats() - function to analize a 2d matix to output information, such as angle between <0,0> as theta, representing as x+yi, etc. will use degriess as it will be easier. valid inputs: [[X,Y]] OR [[X],[Y]] """ from math import * from cmath import * def matrix_xy_stats(matrix): if len(matrix) == 2: x = matrix[0][0] y = matrix[0][1] else: x = matrix[0][0] y = matrix[1][0] print("X:") print("{0}".format(x)) print("Y:") print("{0}".format(y)) print("theta:") theta = atan(x/y) print(theta) # pre processed while theta < 0: theta += 360 while theta > 360: theta -= 360 print(theta) # after filters print("magnitude:") print("abs(abs({0}))".format(sqrt((x)**2+(y)**2))) print("the imaginary i formula is:") print("({0})+({1})*1j".format(x,y))