Loading [MathJax]/jax/output/CommonHTML/jax.js

2019年6月24日月曜日

学習環境

ラング線形代数学(上)(S.ラング (著)、芹沢 正三 (翻訳)、ちくま学芸文庫)の7章(スカラー積と直交性)、2(正値スカラー積)、練習問題5の解答を求めてみる。


  1. 直交化、直交基底。

    u=1v=t-t,11,11t,1=10t·1dt=121,1=101·1dt=1v=t-12w=t2-t2,t-12t-12,t-12(t-12)-t2,11,11t2,t-12=10(t3-12t2)dt=14-12·13=3-212=112t-12,t-12=10(t2-t+14)dt=13-12+14=4-6+312=112t2,1=10t2dt=13w=t2-(t-12)-13=t2-t+16

    正規化、正規直交基底。

    uu=11,1=1vv=t-12t-12,t-12=12(t-12)=23(t-12)=23t-3ww.=t2-t+16t2-t+16,t2-t+16t2-t+16,t2-t+16=10(t4-2t3+43t2-13t+136)dt=15-12+49-16+136=36-90+80-30+55·62=15·62ww=65(t2-t+16)=65t2-65t+5{1,23t-3,65-65t+5}

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, plot, Integral, sqrt

print('5.')

t = symbols('t')


def scalar_mul(f, g):
    return Integral(f * g, (t, 0, 1)).doit()


def norm(f):
    return sqrt(scalar_mul(f, f))


f = 1
g = t
h = t ** 2
u = f / norm(f)
v = g - scalar_mul(g, u) / scalar_mul(u, u) * u
v = v / norm(v)
w = h - scalar_mul(h, v) / scalar_mul(v, v) * v - \
    scalar_mul(h, u) / scalar_mul(u, u) * u

for o in [u, v, w]:
    pprint(o)
    print()

p = plot(f, g, h, u, v, w, ylim=(-10, 10), show=False, legend=True)
colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'pink', 'gray', 'skyblue', 'yellow']
for s, color in zip(p, colors):
    s.line_color = color

p.show()
p.save('sample5.png')

入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))

C:\Users\...>py sample5.py
5.
1

2⋅√3⋅(t - 1/2)

 2       1
t  - t + ─
         6


C:\Users\...>

0 コメント:

コメントを投稿