M.2.D
Gegeben
Gegeben:
die Winkel \(\alpha, \beta\)
die Einheitsvektoren \(\boldsymbol e_\alpha, \boldsymbol e_\beta, \boldsymbol e_\gamma\)
die Vektoren \(\boldsymbol u, \boldsymbol v, \boldsymbol w\) über ihre Komponenten \(u, v, w\) in Richtung der jeweiligen Einheitsvektoren.
Gegebene Größen:
Untersuchen Sie die gegebenen Vektoren. Gehen Sie wie folgt vor.
a) Komponenten der Einheitsvektoren
Berechnen Sie die \((x,y)\)-Komponenten der Einheitsvektoren \(\boldsymbol e_\alpha, \boldsymbol e_\beta, \boldsymbol e_\gamma\):
Und zwar zuerst für die gegebenen Symbole und dann für die gegebenen Größen - und gerundet auf Rundestellenwert \(0{,}01\).
Lösung
b) Komponenten der Vektoren
Berechnen Sie die \((x,y)\)-Komponenten der Vektoren \(\boldsymbol u, \boldsymbol v, \boldsymbol w\):
Und zwar für die gegebenen Größen - und gerundet auf Rundestellenwert \(0{,}01\).
Lösung
Source Code eines Programms dazu: Programm ausführen? Dazu: Copy: Source Code in die Zwischenablage kopieren. Paste: Source Code ins Eingabefeld hinter Play: Knopf SymPy
from sympy.physics.units import *
from sympy import *
# Units:
(mm, cm) = ( m/1000, m/100 )
Newton = kg*m/s**2
kN = 10**3*Newton
Pa = Newton/m**2
MPa = 10**6*Pa
GPa = 10**9*Pa
deg = pi/180
half = S(1)/2
# Rounding:
def iso_round(x, pv):
try:
x = float(x)
tmp = round(x, pv)
except TypeError:
from functools import partial
func = partial(round, ndigits = pv)
tmp = x.applyfunc(func)
return tmp
prec = 2
alpha, beta, gamma = var("α, β, γ")
u, v, w = var("u, v, w")
sub_list=[
(alpha, 150 *pi/180),
(beta, 60 *pi/180),
(gamma, 270 *pi/180),
(u, 4),
(v, 2),
(w, 3),
]
ca, sa = cos(alpha), sin(alpha)
cb, sb = cos(beta), sin(beta)
cc, sc = cos(gamma), sin(gamma)
ea = Matrix([ca, sa])
eb = Matrix([cb, sb])
ec = Matrix([cc, sc])
pprint("\neα, u --- eβ, v --- eγ, w:")
for pair in [(u, ea), (v, eb), (w, ec)]:
pprint("\n")
comp = pair[0]
tmp = pair[1]
tmp = tmp.subs(sub_list)
pprint(tmp)
tmp = iso_round(tmp,prec)
pprint(tmp)
tmp = pair[1]
tmp *= comp
tmp = tmp.subs(sub_list)
tmp = iso_round(tmp,prec)
pprint(tmp)
[ ]: einfügen.▶ drücken.