0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

線形代数における「基底の変換」と「線形写像(線形変換)」の関係

Posted at

参考リンクまとめ

Pythonコード

# -------------------------------
# ライブラリのインポート / Import libraries
# -------------------------------
import numpy as np

# -------------------------------
# 線形空間 V → W の線形写像 A / Linear map A (from V to W)
# -------------------------------
A = np.array([
    [2, 1],
    [0, 3],
    [1, -1]
])  # 3x2 行列, V: R^2 → W: R^3

# -------------------------------
# V空間の基底変換行列 P(2x2)/ Change of basis for V
# -------------------------------
P = np.array([
    [1, 1],
    [0, 2]
])  # 新しい基底 → 標準基底への変換(右から作用)

# -------------------------------
# W空間の基底変換行列 Q(3x3)/ Change of basis for W
# -------------------------------
Q = np.array([
    [1, 0, 1],
    [0, 2, 0],
    [0, 0, 1]
])  # 新しい基底 → 標準基底への変換(右から作用)

# -------------------------------
# 成分ベクトル x(新しいV基底における)/ x under new basis of V
# -------------------------------
x_new = np.array([
    [2],
    [1]
])

# -------------------------------
# B = Q⁻¹ A P による新しい基底での線形写像 / Linear map under new basis
# -------------------------------
Q_inv = np.linalg.inv(Q)
B = Q_inv @ A @ P  # 新しい基底での線形写像行列

# -------------------------------
# y_new = B x_new / 新しい基底での出力成分
# -------------------------------
y_new = B @ x_new

# -------------------------------
# 標準基底での結果と比較 / Compare with original space
# -------------------------------
# x の標準基底表現
x_std = P @ x_new

# 標準基底での y = A x
y_std = A @ x_std

# 新しい基底での y_new → 標準基底に戻す: Q y_new
y_std_from_new = Q @ y_new

# -------------------------------
# 結果表示 / Print results
# -------------------------------
np.set_printoptions(precision=2, suppress=True)

print("Matrix A (standard basis):\n", A)
print("\nMatrix P (change of basis for V):\n", P)
print("\nMatrix Q (change of basis for W):\n", Q)
print("\nMatrix B (transformed linear map):\n", B)

print("\nInput x (new basis):\n", x_new)
print("Input x (standard basis):\n", x_std)

print("\nOutput y = A x (standard basis):\n", y_std)
print("Output y = B x (new basis):\n", y_new)
print("y (from new basis, converted to standard):\n", y_std_from_new)


結果
Matrix A (standard basis):
[[ 2 1]
[ 0 3]
[ 1 -1]]

Matrix P (change of basis for V):
[[1 1]
[0 2]]

Matrix Q (change of basis for W):
[[1 0 1]
[0 2 0]
[0 0 1]]

Matrix B (transformed linear map):
[[ 1. 5.]
[ 0. 3.]
[ 1. -1.]]

Input x (new basis):
[[2]
[1]]
Input x (standard basis):
[[3]
[2]]

Output y = A x (standard basis):
[[8]
[6]
[1]]
Output y = B x (new basis):
[[7.]
[3.]
[1.]]
y (from new basis, converted to standard):
[[8.]
[6.]
[1.]]

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?