{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "Dieses Material ist lizensiert unter der Lizemz Creative Commons Attribution-ShareAlike 4.0 International License .\n", "\n", "
In diesem Notebook lernen Sie, wie man einen Vektor als Linearkombination anderer Vektoren darstellt.
\n", "\n", "Als Beispiel betrachten wir die auch in diesem Video\n", "\n", "\n", "\n", "behandelte Aufgabe, den Vektor $\\vec{b} = \\begin{pmatrix}2 \\\\ 3 \\\\ 4\\end{pmatrix}$ als Linearkombination der Vektoren $\\vec{a}_1 = \\begin{pmatrix}3 \\\\ 2 \\\\ 3\\end{pmatrix},\\vec{a}_2 = \\begin{pmatrix}2 \\\\ 1 \\\\ 0\\end{pmatrix}, \\vec{a}_3 = \\begin{pmatrix}1 \\\\ 0 \\\\ 1\\end{pmatrix}$ darzustellen.\n", "\n", "Wir suchen also Koeffizienten $a,b,c$, so dass $$a \\vec{a}_1 + b\\vec{a}_2 + c \\vec{a}_3 = a \\begin{pmatrix}3 \\\\ 2 \\\\ 3\\end{pmatrix}+ b \\begin{pmatrix}2 \\\\ 1 \\\\ 0\\end{pmatrix} + c \\begin{pmatrix}1 \\\\ 0 \\\\ 1\\end{pmatrix} = \\begin{pmatrix}2 \\\\ 3 \\\\ 4\\end{pmatrix}.$$" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "Zum Verständnis dieser Seite sollten Sie mit dem Lösen von linearen Gleichungssystemen vertraut sein. Diese Aufgaben sollte Ihnen keine Probleme bereiten." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false, "jupyter": { "source_hidden": false } }, "outputs": [ ], "source": [ "b0=vector([2,3,4])\n", "a1=vector([3,2,3])\n", "a2=vector([2,1,0])\n", "a3=vector([1,0,1])" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "Werfen wir zunächst einen Blick auf die Lage dieser Vektoren im Raum." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false, "jupyter": { "source_hidden": true } }, "outputs": [ { "data": { "iframe": "19fa0ff573b18ad124e26130a63e1f8433a5d300", "text/plain": [ "Graphics3d Object" ] }, "output_type": "execute_result" } ], "source": [ "o=vector([0,0,0])\n", "p=arrow(o,b0,color=\"green\")\n", "p1=arrow(o,a1)\n", "p2=arrow(o,a2)\n", "p3=arrow(o,a3)\n", "show(p+p1+p2+p3, viewer=\"threejs\")" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "Wir sehen, dass die 3 blauen Vektoren $\\vec{a}_1, \\vec{a}_2,\\vec{a}_3$ nicht alle in einer Ebene liegen. Sie sind also linear unabhängig. \n", "Wir suchen Zahlen $a,b,c$, so dass $a\\cdot\\vec{a}_1+b\\cdot\\vec{a}_2+c\\cdot\\vec{a}_3=\\vec{b}$ ist. Daraus ergibt sich für jede der 3 Komponenten eine Gleichung in den Variablen $a,b,c$. Diese Gleichungen bilden ein lineares Gleichungssystem $GS$." ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false, "jupyter": { "source_hidden": true }, "tags": [ ] }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[3*a + 2*b + c == 2, 2*a + b == 3, 3*a + c == 4]" ] }, "execution_count": 11, "metadata": { }, "output_type": "execute_result" } ], "source": [ "var('a,b,c')\n", "g0 = a*a1[0]+b*a2[0]+c*a3[0] == b0[0]\n", "g1 = a*a1[1]+b*a2[1]+c*a3[1] == b0[1]\n", "g2 = a*a1[2]+b*a2[2]+c*a3[2] == b0[2]\n", "GS = [g0,g1,g2]\n", "show(GS)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "Wir lösen das Gleichungssystem $GS$:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "jupyter": { "source_hidden": true } }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[[a == 2, b == -1, c == -2]]" ] }, "execution_count": 5, "metadata": { }, "output_type": "execute_result" } ], "source": [ "sol=solve(GS,a,b,c)\n", "show(sol)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "Wir entnehmen der Lösung die gefundenen Koeffizienten und setzen sie in die Linearkombination $a \\vec{a}_1 + b\\vec{a}_2 + c \\vec{a}_3 = \\vec{b}$ ein." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false, "jupyter": { "source_hidden": true } }, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 6, "metadata": { }, "output_type": "execute_result" } ], "source": [ "ca=sol[0][0].rhs()\n", "cb=sol[0][1].rhs()\n", "cc=sol[0][2].rhs()\n", "ca*a1+cb*a2+cc*a3==b0" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "**Kontrollaufgabe:**\n", "\n", "" ] }, { "cell_type": "code", "execution_count": 0, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 9.4", "language": "sagemath", "metadata": { "cocalc": { "description": "Open-source mathematical software system", "priority": 10, "url": "https://www.sagemath.org/" } }, "name": "sage-9.4", "resource_dir": "/ext/jupyter/kernels/sage-9.4" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.15" } }, "nbformat": 4, "nbformat_minor": 4 }