I write about science and technology, mostly. I live in the Port Stephens area in Australia and love my garden.
Alrighty then…
I made a few pretty graphs by taking the norm of each row and column of previously mentioned matrices with primes.
Here are the codez I didz:
from matplotlib import pyplot as plt
from numpy import linalg as npla
import primematrix as pm
norpt = pm.pmatrix_norptcol()
rpt = pm.pmatrix_rptcol()
npla.inv(norpt)
npla.inv(rpt)
‘’’
Haven’t included the inverted matrices of the above,
just doing it to say that they are invertible according
to the numpy library.
‘’’
npla.norm(norpt)
>>> 123.3288287465668
npla.norm(rpt)
>>> 513.29328848135151
plt.style.use(‘ggplot’)
plt.figure()
plt.plot([npla.norm(row) for row in norpt], label=’No Repeat’)
plt.plot([npla.norm(row) for row in norpt.T], label=’Transpose No Repeat’)
plt.plot([npla.norm(row) for row in rpt], label=’Repeat’)
plt.plot([npla.norm(row) for row in rpt.T], label=’Transpose Repeat’)
plt.legend()
plt.show()
Nothing complex, but if you aren’t familiar with the stuff above, it’s this:
By the way, the default norm from numpy.linalg.norm is the Frobenius norm. This function can take arguments to calculate several different norms if desired.
This kind of thing is fun and rewarding for someone like me. The whole process of thinking, understanding what I’m doing, representing this as code and outputting it visually, really is my jam. It’s pretty cool.
Therefore, without further ado, let me present the fruit of my labours:
Frobenius norms of weird matrices
Ahhh… that’s why I do what I do.
I find it interesting how the default norepeat matrix dips in size and then grows. I may take it upon myself to plot very large forms of these matrices in the near future.
Adios