M.5.B

a) Zwei Unbekannte

Gegeben sind 2 Aussagen für die Unbekannten \(x, y\). Und zwar Aussagen in Form eines linearen Gleichungssystems:

\begin{align*} 2 x + 3 y &= 6 \\ 4 x + 9 y &= 15 \\ \end{align*}

Lösen Sie nach den Unbekannten auf.

Lösung

\begin{align*} x &= \tfrac 3 2 \\ y &= 1 \\ \end{align*}

SymPy

Source Code eines Programms dazu:

from sympy.physics.units import *
from sympy import *

var("x, y")

eq1 = Eq( 2*x + 3*y,  6)
eq2 = Eq( 4*x + 9*y, 15)

pprint("\nSolution:")
sol = solve([eq1, eq2], [x, y])
pprint(sol)

# pprint("\nQuiz:")
# eq1 = Eq( 2*x - 1*y, 80)
# eq2 = Eq( 4*x + 8*y, -60)

# for eq in [eq1, eq2]:
#    pprint(eq)

# pprint("\nSolution:")
# sol = solve([eq1, eq2], [x, y])
# pprint(sol)

Programm ausführen? Dazu:

  1. Copy: Source Code in die Zwischenablage kopieren.

  2. Paste: Source Code ins Eingabefeld hinter [ ]: einfügen.

  3. Play: Knopf ▶ drücken.

b) Drei Unbekannte

Gegeben sind 3 Aussagen für die Unbekannten \(x, y, z\). Und zwar Aussagen in Form eines linearen Gleichungssystems:

\begin{align*} 3 x + 2 y - z &= 1 \\ 2 x -2 y + 4 z &= -2 \\ - x + \tfrac 1 2 y - z &= 0 \end{align*}

Lösen Sie nach den Unbekannten auf.

Lösung

Matrix-Notation:

\[\begin{split}\begin{bmatrix} 3 & 2 & -1\\ 2 & -2 & 4\\ -1 & \tfrac{1}{2} & -1 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} 1 \\ -2 \\ 0 \end{bmatrix}\end{split}\]

Lösung:

\begin{align*} \begin{bmatrix} x \\ y \\ z \end{bmatrix} &= \begin{bmatrix} 1 \\ -2 \\ -2 \end{bmatrix} \end{align*}

Lösung anders notiert:

\begin{align*} x &= 1 \\ y &= -2 \\ z &= -2 \end{align*}

SymPy

Source Code eines Programms dazu:

from sympy.physics.units import *
from sympy import *

var("x, y, z")
half = S(1)/2

A = Matrix([
    [3,     2, -1],
    [2,    -2,  4],
    [-1, half, -1]
    ])
v = Matrix([x, y, z])
b = Matrix([1, -2, 0])

eq = Eq(A*v, b)

pprint("\nSolution:")
sol = solve(eq, v)
pprint(sol)

# pprint("\nQuiz:")
# eq1 = Eq( 2*x + 2*y + 2*z,  84)
# eq2 = Eq( 4*x + 8*y, 168)
# eq3 = Eq( -x + 6*y + 6*z,  364)

# for eq in [eq1, eq2, eq3]:
#    pprint(eq)

# pprint("\nSolution:")
# sol = solve([eq1, eq2, eq3], [x, y, z])
# pprint(sol)

Programm ausführen? Dazu:

  1. Copy: Source Code in die Zwischenablage kopieren.

  2. Paste: Source Code ins Eingabefeld hinter [ ]: einfügen.

  3. Play: Knopf ▶ drücken.

c) Drei Unbekannte und Symbole

Gegebene Symbole: \(a, b\).

Gegeben außerdem 3 Aussagen für die Unbekannten \(x, y, z\).

\begin{align*} 3 x + 2 y - z &= 6 a \\ 2 x -2 y + 4 z &= 6 b \\ - x + \tfrac 1 2 y - z &= 0 \end{align*}

Lösung

\begin{align*} x &= - 3 b \\ y &= 4a + 8 b \\ z &= 2a + 7b \end{align*}

SymPy

Source Code eines Programms dazu:

from sympy.physics.units import *
from sympy import *

half = S(1)/2

var("x, y, z")
unks = Matrix([x, y, z])

A = Matrix([
    [3,     2, -1],
    [2,    -2,  4],
    [-1, half, -1]
    ])

var("a, b")
rhs = Matrix([6*a, 6*b, 0])

eq = Eq(A*unks, rhs)

pprint("\nSolution:")
sol = solve(eq, unks)
pprint(sol)

Programm ausführen? Dazu:

  1. Copy: Source Code in die Zwischenablage kopieren.

  2. Paste: Source Code ins Eingabefeld hinter [ ]: einfügen.

  3. Play: Knopf ▶ drücken.

d) Sechs Unbekannte und Symbole / Größen

../../../_images/M.5.B.png

Gegebene Symbole: \(a, F, q.\)

Gegebene Größen:

\[\begin{split}a&= 1\,\mathrm{m}\\ F&= 1\,\mathrm{N}\\ q&= 1\,\tfrac{\mathrm{N}}{\mathrm{m}}\end{split}\]

Lösen Sie das Lineare Gleichungssystem bestehend aus 6 Gleichungen für die 6 Unbekannten \(A_h, A_v, M_A, B_v, G_h, G_v\).

Berechnen Sie die 6 Unbekannten:

  • für die gegebenen Symbole und

  • für die gegebenen Größen.

Lösung

Lösung für die 6 Unbekannten:

  • für die gegebenen Symbole:

\begin{align*} A_{h} &= 0 \\ A_{v} &= - F \\ B_{v} &= 2 F + 2 a q \\ G_{h} &= 0 \\ G_{v} &= F \\ M_A &= F a \end{align*}
  • für die gegebenen Größen

\[\begin{split}A_{h} &= 0 \\ A_{v} &= -1 \,\mathrm{N} \\ B_{v} &= 4 \, \mathrm{N} \\ G_{h} &= 0 \\ G_{v} &= 1 \,\mathrm{N} \\ M_A &= 1 \,\mathrm{Nm}\end{split}\]

SymPy

Source Code eines Programms dazu:

from sympy import *
from sympy.physics.units import kg, m, s

Newton = kg*m/s**2

var("a, F, q")

sub_list=[
    ( a, 1  *m          ),
    ( F, 1  *Newton     ),
    ( q, 1  *Newton/m   ),
    ]

# sub_list=[
#     ( a, 3  *m          ),
#     ( F, 4  *Newton     ),
#     ( q, 2  *Newton/m   ),
#     ]

# Unknowns:
var("Ah, Av, MA, Bv, Gh, Gv")

R = 2*a*q

# Equations:
eq1 = Eq(  Gh, 0                   )
eq2 = Eq(  - Bv + F + Gv + R, 0    )
eq3 = Eq(  2*a*F + a*(-Bv + R), 0  )
eq4 = Eq(  Ah + Gh, 0              )
eq5 = Eq(  Av + Gv , 0             )
eq6 = Eq(  Gv*a - MA, 0            )

unks = [Ah, Av, MA, Bv, Gh, Gv]
eqs = [eq1, eq2, eq3, eq4, eq5, eq6]

for e in eqs:
    pprint(e)

pprint("\nSolution in terms of given *symbols*:")
sol = solve(eqs, unks)
for s in sorted(sol,key=default_sort_key):
    pprint(s)
    pprint(sol[s])
    pprint("\n")

pprint("\nSolution in terms of given *quantities*:")
for s in sorted(sol,key=default_sort_key):
    tmp = s
    tmp = str(tmp)+":"
    pprint(tmp)
    tmp = sol[s]
    tmp = tmp.subs(sub_list)
    if s != MA:
        tmp /= Newton
        tmp = str(tmp)+" N"
    else:
        tmp /= Newton*m
        tmp = str(tmp)+" Nm"
    pprint(tmp)
    pprint("\n")

Programm ausführen? Dazu:

  1. Copy: Source Code in die Zwischenablage kopieren.

  2. Paste: Source Code ins Eingabefeld hinter [ ]: einfügen.

  3. Play: Knopf ▶ drücken.