This file contains hidden or 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 | |
| from numpy import linalg as la | |
| def get_rotation_matrix(e1, e2, theta): | |
| R = np.array([ | |
| [ np.cos(theta), -np.sin(theta) ], | |
| [ np.sin(theta), np.cos(theta) ] | |
| ]) |
This file contains hidden or 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
| from matplotlib import pyplot as plt | |
| import matplotlib.patches as patches | |
| def show_complementary_cone_2d(M): | |
| # 行列のサイズを取得 | |
| n = M.shape[0] | |
| # 各列ベクトルを単位ベクトルに変換 | |
| for i in range(n): |
This file contains hidden or 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 math | |
| from itertools import product, combinations | |
| import numpy as np | |
| from numpy import linalg as la | |
| import matplotlib.pyplot as plt | |
| import mpl_toolkits.mplot3d.art3d as art3d | |
| color_cycle = plt.rcParams['axes.prop_cycle'].by_key()['color'] | |
| n_color = len(color_cycle) |
This file contains hidden or 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
| from itertools import product | |
| import numpy as np | |
| from numpy import linalg as la | |
| from matplotlib import pyplot as plt | |
| import matplotlib.patches as patches | |
| import pulp | |
| def is_q_matrix(M): | |
| # 問題のサイズを取得 |
This file contains hidden or 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 pulp | |
| import random | |
| class TwiceClapGame: | |
| def __init__(self, n): | |
| # 最大チャージ数 | |
| self.n = n | |
| # 設定 |
This file contains hidden or 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 pulp | |
| # 参加者数 | |
| n = 50 | |
| # プレート重み | |
| A = np.random.rand(n, n) | |
| # 合格重み |
NewerOlder