(*^ ::[ 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, "Times New Roman", 12, L0, bold, italic; fontset = smalltext, "Helv", 10, L0; fontset = input, "Courier New", 12, L0, nowordwrap; fontset = output, "Courier New", 12, L0, nowordwrap; 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, "Helv", 12, L0, center, nowordwrap, nohscroll; 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; ] Programmierung (Packages) :[font = text; inactive; startGroup; Cclosed; ] Copyright :[font = text; inactive; endGroup; ] Copyright 1994, Claudia Funke und Markus Herold 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 = subsection; inactive; startGroup; Cclosed; ] Packages :[font = text; inactive; ] Das Ziel bemi Schreiben eines Packages ist es, die eigenen Funktionen ähnlich den bereits in Mathematica vorhandenen Funktionen in das System zu integrieren. :[font = text; inactive; ] Folgende Fehler können auftreten, wenn eigene Funktionen oder Definitionen innerhalb einer Mathematica-Session eingelesen werden: - Variablen, die innerhalb eigener Definitionen verwendet werden, wurden bereits innerhalb des Session definiert und mit Werten belegt. - Variable werden als Funktionsargumente übergeben und gleichzeitig innerhalb der eigenen Funktion lokal angewendet. - Eine Funktion mit gleichem Namen wurde bereits definiert. - Hilfsfunktionen oder Hilfsvariablen, die innerhalb eines Packages verwendet werden, sind für den/die Anwendenden sichtbar und im Zugriff. Damit besteht ein unkontrollierbar Zugriff auf die Funktions- implementierung. :[font = text; inactive; ] Das folgende Beispiel demonstriert eines dieser Probleme. Dazu sei folgendes, selbst entwickeltes Mini-Package angenommen: :[font = input; nowordwrap; ] (* Package schlecht.m *) (* Die Funktion berechnet die Potenzfunktion x^n. *) PowerSum[x_, n_] := Sum[x^i, {i, 1, n}] :[font = text; inactive; ] Das Packages liegt als File vor und muß noch eingelesen werden. :[font = input; nowordwrap; ] <