(*^ ::[ frontEndVersion = "Microsoft Windows Mathematica Notebook Front End Version 2.2"; microsoftWindowsStandardFontEncoding; fontset = title, "Helv", 24, L0, center, nohscroll, bold; fontset = subtitle, "Helv", 18, L0, center, nohscroll, bold; fontset = subsubtitle, "Helv", 14, L0, center, nohscroll, bold; fontset = section, "Helv", 14, L0, bold, grayBox; fontset = subsection, "Helv", 12, L0, bold, blackBox; fontset = subsubsection, "Helv", 10, L0, bold, whiteBox; fontset = text, "Helv", 12, L0; fontset = smalltext, "Helv", 10, L0; fontset = input, "Courier New", 12, L0, nowordwrap, bold; fontset = output, "Courier New", 12, L0, nowordwrap, bold; fontset = message, "Courier New", 10, L0, nowordwrap, R65280; fontset = print, "Courier New", 10, L0, nowordwrap; fontset = info, "Courier New", 10, L0, nowordwrap; fontset = postscript, "Courier New", 8, L0, nowordwrap; fontset = name, "Helv", 10, L0, nohscroll, italic, B65280; fontset = header, "Helv", 18, L0, nohscroll, bold; fontset = footer, "Helv", 18, L0, center, nohscroll, bold; fontset = help, "Helv", 10, L0, nohscroll; fontset = clipboard, "Helv", 12, L0, nohscroll; fontset = completions, "Helv", 12, L0, nowordwrap, nohscroll; fontset = graphics, "Courier New", 10, L0, nowordwrap, nohscroll; fontset = special1, "Arial", 12, L0, center, nowordwrap, nohscroll, bold; fontset = special2, "Helvetica", 12, L0, center, nowordwrap, nohscroll, bold; fontset = special3, "Helv", 12, L0, right, nowordwrap, nohscroll; fontset = special4, "Helv", 12, L0, nowordwrap, nohscroll; fontset = special5, "Helv", 12, L0, nowordwrap, nohscroll; fontset = leftheader, "Helv", 12, L0, nowordwrap, nohscroll; fontset = leftfooter, "Helv", 12, L0, nowordwrap, nohscroll; fontset = reserved1, "Courier New", 10, L0, nowordwrap, nohscroll;] :[font = section; inactive; startGroup; ] Operationen auf Skalare, Vektoren und Matrizen :[font = subsection; inactive; startGroup; Cclosed; ] Copyright :[font = text; inactive; endGroup; ] Copyright 1994, Claudia Funke TU-Berlin, FB 13, Fachgebiet Ökonometrie und Statistik Dieses Notebook darf ausschließlich als Unterrichtsmaterial und für private Zwecke verwendet und nicht ohne Zustimmung der Autorin verändert werden. :[font = text; inactive; ] Die meisten in Mathematica verfügbaren mathematischen Operatoren sind so implementiert, daß sie auf einen Vektor und eine Matrix angewendet diese elementweise auswerten. Im folgenden werden die wichtigsten dieser mathematischen Operatoren beschrieben. Dabei wird Ordnungskonformität der betrachteten Vektoren und Matrizen vorausgesetzt. :[font = subsubsection; inactive; startGroup; Cclosed; ] Numerische Operatoren :[font = subsubsection; inactive; startGroup; Cclosed; ] Addition/Subtraktion :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] A = B + C :[font = text; inactive; ] mit A = (m,n) - Matrix, B = (m,n) - Matrix, C = (m,n) - Matrix :[font = input; nowordwrap; ] b = { {1,2}, {3,4} }; MatrixForm[b] :[font = input; nowordwrap; ] c = { {c11,c12}, {c21,c22} }; MatrixForm[c] :[font = input; nowordwrap; ] a = b + c; MatrixForm[a] :[font = text; inactive; ] Wird ein Skalar zu einer Matrix addiert/subtrahiert, expandiert Mathematica diesen intern zu einer Matrix gleicher Größe. :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] A = B + s :[font = text; inactive; backColorRed = 65280; backColorGreen = 65280; backColorBlue = 65280; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Helv"; fontSize = 12; ] mit A = (m,n) - Matrix, B = (m,n) - Matrix, s = (1,1) - Matrix :[font = input; startGroup; nowordwrap; ] a = b + s; MatrixForm[a] :[font = output; inactive; formatted; output; endGroup; endGroup; nowordwrap; ] MatrixForm[{{1 + s, 2 + s}, {3 + s, 4 + s}}] ;[o] 1 + s 2 + s 3 + s 4 + s :[font = subsubsection; inactive; startGroup; Cclosed; ] Multiplikation :[font = text; inactive; ] Das normale Matrizenprodukt ist als :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] A = B * C :[font = text; inactive; backColorRed = 65280; backColorGreen = 65280; backColorBlue = 65280; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Helv"; fontSize = 12; ] mit A = (m,n) - Matrix, B = (m,k) - Matrix, C = (k,n) - Matrix :[font = text; inactive; ] und :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] k a_ij = Sum b_ir c_ij r=1 :[font = text; inactive; ] definiert. :[font = input; nowordwrap; ] d = { {4,3}, {2,5} }; MatrixForm[d] :[font = text; inactive; ] Die Multiplikation zweier Matrizen kann numerisch :[font = input; nowordwrap; ] a = b . d; MatrixForm[a] :[font = text; inactive; ] wie auch symbolisch erfolgen. :[font = input; nowordwrap; ] a = b . c; MatrixForm[a] :[font = text; inactive; ] Die Multiplikation einer Matrix mit einem Vektor ist ebenfalls kein Problem. :[font = input; nowordwrap; ] a = b . {v1, v2}; MatrixForm[a] :[font = text; inactive; ] Bei der Multiplikation einer Matrix mit einem Skalar wird jedes Element der Matrix mit dem Skalar multipliziert. :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] A = B * s :[font = text; inactive; backColorRed = 65280; backColorGreen = 65280; backColorBlue = 65280; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Helv"; fontSize = 12; ] mit A = (m,n) - Matrix, B = (m,n) - Matrix, s = (1,1) - Matrix :[font = input; nowordwrap; ] a = s b; MatrixForm[a] :[font = text; inactive; ] Das n-te Produkt einer Matrix :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] n A = Prod B_i i=1 :[font = text; inactive; ] wird mit :[font = special1; inactive; output; nowordwrap; nohscroll; center; ] MatrixPowert[ Liste, n ] :[font = text; inactive; ] berechnet. :[font = input; nowordwrap; ] b = { {b11,b12}, {b21,b22} }; MatrixForm[b] :[font = input; nowordwrap; ] a = MatrixPower[b, 3]; MatrixForm[a] :[font = input; nowordwrap; ] Dimensions[a] :[font = text; inactive; endGroup; endGroup; ] Bei der Reihenfolge der Operatoren muß nicht auf Ordnungskonformität geachtet werden, da der dot-Operator . sowohl die Möglichkeit der Prämultiplikation als auch der Postmultiplikation prüft und die Operation ausführt, die möglich ist. Für das Multiplizieren von Vektoren gilt, daß Mathematica nur Listen kennt und daher ebenfalls nicht auf Ordnungs- konformität in der Reihenfolge der Operanden prüft. :[font = subsubsection; inactive; startGroup; Cclosed; ] Spezielle Vektorprodukte :[font = text; inactive; ] Das innere Produkt zweier Vektoren (Skalarprodukt) :[font = special1; inactive; output; nowordwrap; nohscroll; center; ] z = u' * v :[font = text; inactive; backColorRed = 65280; backColorGreen = 65280; backColorBlue = 65280; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Helv"; fontSize = 12; ] mit z = (1,1) - Matrix, u = (n,1) - Matrix, v = (n,1) - Matrix :[font = text; inactive; ] und :[font = special1; inactive; output; nowordwrap; nohscroll; center; ] n Sum u_i v_i i=1 :[font = text; inactive; ] wird ebenfalls über den dot-Operator berechnet. :[font = input; nowordwrap; ] u = {1, 2, 3}; v = {v1, v2, v3}; :[font = input; nowordwrap; ] z = u . v :[font = text; inactive; ] Das äußere Produkt zweier Vektoren (dyadisches Produkt) :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] Z = u * v' :[font = text; inactive; backColorRed = 65280; backColorGreen = 65280; backColorBlue = 65280; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Helv"; fontSize = 12; ] mit Z = (m,n) - Matrix, u = (m,1) - Matrix, v = (n,1) - Matrix :[font = text; inactive; ] und :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] Z_ij = v_i u_j i = 1, 2, ... , n; j = 1, 2, ..., n :[font = text; inactive; ] wird mit der Funktion :[font = special1; inactive; output; nowordwrap; nohscroll; center; ] Outer[ Times, Liste1, Liste2 ] :[font = text; inactive; ] berechnet. :[font = input; endGroup; nowordwrap; ] z = Outer[Times, u, v]; MatrixForm[z] :[font = subsubsection; inactive; startGroup; Cclosed; ] Kronekerprodukt :[font = text; inactive; ] Mit der gleichen Funktion wird auch das Kroneckerprodukt ermittelt. :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] A = B Ø C :[font = text; inactive; backColorRed = 65280; backColorGreen = 65280; backColorBlue = 65280; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Helv"; fontSize = 12; ] mit A = (mp,nq) - Matrix, u = (m,n) - Matrix, v = (p,q) - Matrix Ø ist der Ersatz für das hier nicht darstellbare Zeichen des Kroneckerproduktes :[font = text; inactive; ] mit :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] a_ij = b_ij C, i = 1, 2, ... , n; j = 1, 2, ..., n :[font = input; nowordwrap; ] b = { {b11,b12},{b21,22} }; c = { {c11,c12}, {c21,c22}, {c31,c32} }; a = Outer[Times, b, c] :[font = input; nowordwrap; ] MatrixForm[a] :[font = input; endGroup; nowordwrap; ] Dimensions[a] :[font = subsubsection; inactive; startGroup; Cclosed; ] Potenzen :[font = text; inactive; ] Der Potenzoperator ^ kann ebenfalls auf eine Matrix angewandt werden und ergibt :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] a_ij = b_ij^n :[font = input; nowordwrap; ] b = { {b11,b12}, {b21,b22} }; a = b^2; MatrixForm[a] :[font = text; inactive; ] Der Exponent selbst kann auch eine Matrix sein und es ergibt sich dann :[font = special2; inactive; output; nowordwrap; nohscroll; center; ] a_ij = b_ij^c_ij :[font = input; endGroup; endGroup; nowordwrap; ] c = { {c11,c12}, {c21,c22} }; a = b^c; MatrixForm[a] ^*)