From fd78d0fd00e6b98ae8b9894db8be028575e205ac Mon Sep 17 00:00:00 2001 From: syn Date: Sun, 16 Feb 2020 11:56:52 +0300 Subject: Init commit --- four.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 four.py (limited to 'four.py') diff --git a/four.py b/four.py new file mode 100644 index 0000000..4f7cd54 --- /dev/null +++ b/four.py @@ -0,0 +1,55 @@ +from libsolve import * +from fractions import Fraction +import numpy as np + +FOUR_SIMEQ = '\\overset{{\\texttt{{two.py}}}}\\simeq' + +# generate figure as plain file, so we can \input it +def gen_figure(figname, text): + with open(f'figures/fig_four_{figname}.tex', 'w') as fd: + fd.write('$$' + text + '$$') + +A = Matrix([ + [-1, 1, 1, -1], + [-7, 4, 4, -3], + [4, -1, -2, 1], + [4, -1, -2, 1] +]) + +lbdE = Matrix([ + [Poly([0, 1]), 0, 0, 0], + [0, Poly([0, 1]), 0, 0], + [0, 0, Poly([0, 1]), 0], + [0, 0, 0, Poly([0, 1])] +]) + +# uncomment to see characteristic poly +#print((A - lbdE).det()) + + + +A = A - Matrix([ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, 0, 0, 1] +]) + +A = A@A + +before = A.to_tex() + +A.triangulate() + +A.make_D(0, -1) +A.make_U(1, 2) +A.make_D(1, Fraction(1, 4)) + +gen_figure('fsr_A_T', +f''' + {before} + {FOUR_SIMEQ} + {A.to_tex()} +''') + +print(A) \ No newline at end of file -- cgit v1.2.1-18-gbd029