Created
April 17, 2021 16:15
-
-
Save junpeitsuji/705ebf7c07f4772ce5f77955b79930c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import math | |
# (√6+√2)/2 の共役元 | |
alpha1 = (math.sqrt(6)+math.sqrt(2))/2 | |
alpha2 = (math.sqrt(6)-math.sqrt(2))/2 | |
alpha3 = (-math.sqrt(6)+math.sqrt(2))/2 | |
alpha4 = (-math.sqrt(6)-math.sqrt(2))/2 | |
a1=math.log(np.abs(alpha1)) | |
a2=math.log(np.abs(alpha2)) | |
a3=math.log(np.abs(alpha3)) | |
a4=math.log(np.abs(alpha4)) | |
b1=math.log(np.abs(alpha1**3 - 3*alpha1 - 1)) | |
b2=math.log(np.abs(alpha2**3 - 3*alpha2 - 1)) | |
b3=math.log(np.abs(alpha3**3 - 3*alpha3 - 1)) | |
b4=math.log(np.abs(alpha4**3 - 3*alpha4 - 1)) | |
c1=math.log(np.abs(alpha1**3 - alpha1**2 - 3*alpha1 + 2)) | |
c2=math.log(np.abs(alpha2**3 - alpha2**2 - 3*alpha2 + 2)) | |
c3=math.log(np.abs(alpha3**3 - alpha3**2 - 3*alpha3 + 2)) | |
c4=math.log(np.abs(alpha4**3 - alpha4**2 - 3*alpha4 + 2)) | |
d1=1 | |
d2=1 | |
d3=1 | |
d4=1 | |
# ε = (153√6 - 265√2)/2 の共役元を計算 | |
epsilon1=(153*math.sqrt(6)-265*math.sqrt(2))/2 | |
epsilon2=(153*math.sqrt(6)+265*math.sqrt(2))/2 | |
epsilon3=(-153*math.sqrt(6)-265*math.sqrt(2))/2 | |
epsilon4=(-153*math.sqrt(6)+265*math.sqrt(2))/2 | |
e1=math.log(np.abs(epsilon1)) | |
e2=math.log(np.abs(epsilon2)) | |
e3=math.log(np.abs(epsilon3)) | |
e4=math.log(np.abs(epsilon4)) | |
#行列の作成 | |
A=np.array([[a1,b1,c1,d1],[a2,b2,c2,d2],[a3,b3,c3,d3],[a4,b4,c4,d4]]) | |
print(A) | |
#逆行列の計算 | |
inv_A = np.linalg.inv(A) | |
print(inv_A) | |
#k,l,m,nを求める | |
print(inv_A * np.matrix([[e1],[e2],[e3],[e4]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment