diff options
author | syn <isaqtm@gmail.com> | 2020-02-16 11:56:52 +0300 |
---|---|---|
committer | syn <isaqtm@gmail.com> | 2020-02-16 11:56:52 +0300 |
commit | fd78d0fd00e6b98ae8b9894db8be028575e205ac (patch) | |
tree | ee9dd35e871d222aa60a1958e9b6f28eaa6ecc54 /four.py | |
download | alg3-fd78d0fd00e6b98ae8b9894db8be028575e205ac.tar.gz |
Init commit
Diffstat (limited to 'four.py')
-rw-r--r-- | four.py | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -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 |