In [71]:
from pylab import *
import skrf as rf


def rando(*args):
    return 2*rand(*args)-.5

def plot_vector(a, off=[0,0], **kwargs):
    '''
    plot a  vector
    '''
    a0,a1 = a[0], a[1]
    off0, off1= off[0], off[1] # offset components of vector tail
    quiver(off0,off1,a0,a1,scale_units ='xy', angles='xy',scale=1, **kwargs)




a,b,c,d = rand(4)*2-1#-.3,.9,.1,-.01
I = matrix(eye(2))
F = matrix([[a,b],[c,d]])  # random linear operator
G = matrix([[a,b],[b,d]]) # reciprocal linear operator 
Z = matrix([[a,b],[b,a]]) # reciprocal+symetric

# 
# mesh to visualize the space
mesh = [array([[x],[y]]) for x in r_[-1:1:11j] for y in r_[-1:1:11j]]


l = [('Original',I),
     ('Random Linear operator',F),
     ('Reciprocal Operator',G),
     ('Mirrored+Reciprocal Operator',Z),
     ]

close('all')

figure(figsize=(8,8))

for idx,t in enumerate(l):
    subplot(221+idx)
    title(t[0])
    omesh =  [t[1]*k for k in mesh]
    [scatter(k[0,0],k[1,0]) for k in omesh]
    vals, vect = eig(t[1])
    
    plot_vector(vect[:,1].real)
    plot_vector(vect[:,0].real)
    


rf.foaf(axis,[-2,2,-2,2])
tight_layout()
draw();show()


Minkowski


In [ ]: