Thursday 2 November 2017

1 4 Einfach Moving Averages Financial Algebra


21 SQL für Analyse und Reporting Um diese Operationen auszuführen, fügen die analytischen Funktionen der SQL-Verarbeitung mehrere neue Elemente hinzu. Diese Elemente bauen auf vorhandenen SQL auf, um flexible und leistungsfähige Berechnungsausdrücke zu ermöglichen. Mit wenigen Ausnahmen haben die analytischen Funktionen diese neuen Elemente. Der Verarbeitungsablauf ist in Abbildung 21-1 dargestellt. Abbildung 21-1 Verarbeitungsauftrag Die wesentlichen Konzepte, die in analytischen Funktionen verwendet werden, sind: Die Abfrageverarbeitung mit Hilfe von analytischen Funktionen erfolgt in drei Stufen. Erstens, alle Joins, WHERE. GROUP BY und HAVING-Klauseln durchgeführt. Zweitens wird die Ergebnismenge den analytischen Funktionen zur Verfügung gestellt, und alle ihre Berechnungen erfolgen. Drittens, wenn die Abfrage eine ORDER BY-Klausel an ihrem Ende hat, wird die ORDER BY verarbeitet, um eine präzise Ausgabeordnung zu ermöglichen. Die Verarbeitungsreihenfolge ist in Abbildung 21-1 dargestellt. Ergebnismengenpartitionen Die analytischen Funktionen ermöglichen es Benutzern, Abfrageergebnismengen in Gruppen von Zeilen, die als Partitionen bezeichnet werden, zu teilen. Beachten Sie, dass der Begriff Partitionen, die mit analytischen Funktionen verwendet werden, nicht mit dem Tabellenpartitionsmerkmal verknüpft ist. In diesem Kapitel bezieht sich der Begriff Partitionen nur auf die Bedeutung der analytischen Funktionen. Partitionen werden nach den Gruppen definiert, die mit GROUP BY-Klauseln definiert sind, sodass sie für alle aggregierten Ergebnisse wie Summen und Durchschnittswerte verfügbar sind. Partitionsbereiche können auf beliebigen Spalten oder Ausdrücken basieren. Eine Abfrageergebnismenge kann in nur eine Partition partitioniert werden, die alle Zeilen, einige große Partitionen oder viele kleine Partitionen mit nur wenigen Zeilen enthält. Für jede Zeile in einer Partition können Sie ein Schiebefenster von Daten definieren. Dieses Fenster bestimmt den Bereich der Zeilen, die für die Berechnung der aktuellen Zeile verwendet werden. Fenstergrößen können entweder auf eine physikalische Anzahl von Zeilen oder ein logisches Intervall wie Zeit basieren. Das Fenster hat eine Anfangszeile und eine Endzeile. Je nach ihrer Definition kann sich das Fenster an einem oder beiden Enden bewegen. Beispielsweise würde ein Fenster, das für eine kumulative Summenfunktion definiert ist, seine Startzeile in der ersten Zeile seiner Partition festgelegt, und seine Endzeile würde vom Anfangspunkt bis zur letzten Zeile der Partition verschoben. Im Gegensatz dazu würde ein Fenster, das für einen gleitenden Durchschnitt definiert ist, sowohl seine Anfangs - als auch seine Endpunkte gleiten lassen, so daß sie einen konstanten physikalischen oder logischen Bereich beibehalten. Ein Fenster kann so groß sein wie alle Zeilen in einer Partition oder nur ein Schiebefenster einer Zeile innerhalb einer Partition. Wenn ein Fenster in der Nähe eines Rahmens ist, gibt die Funktion Ergebnisse nur für die verfügbaren Zeilen zurück, anstatt Sie zu warnen, dass die Ergebnisse nicht das sind, was Sie wollen. Bei der Verwendung von Fensterfunktionen ist die aktuelle Zeile während der Berechnungen enthalten, so dass Sie nur n (n) angeben sollten, wenn Sie mit n Elementen zu tun haben. Jede Berechnung, die mit einer analytischen Funktion durchgeführt wird, basiert auf einer aktuellen Zeile innerhalb einer Partition. Die aktuelle Zeile dient als Referenzpunkt, der den Anfang und das Ende des Fensters bestimmt. Beispielsweise könnte eine zentrierte gleitende Durchschnittsberechnung mit einem Fenster definiert werden, das die aktuelle Zeile, die sechs vorhergehenden Zeilen und die folgenden sechs Zeilen enthält. Dies würde ein Schiebefenster von 13 Reihen erzeugen (siehe Abbildung 21-2). Abbildung 21-2 Schiebefenster Beispiel Rangierfunktionen Eine Rangfolgefunktion berechnet den Rang eines Datensatzes im Vergleich zu anderen Datensätzen im Datensatz anhand der Werte eines Satzes von Maßnahmen. Die Typen der Ranking-Funktion sind: Sample Linear Regression Berechnung In diesem Beispiel berechnen wir eine Regressionsgerade, die die Menge eines Produktes als lineare Funktion des Produktlistenpreises ausdrückt. Die Berechnungen werden nach Vertriebskanal gruppiert. Die Werte SLOPE. INTCPT. RSQR sind Steigung, Intercept und Bestimmungskoeffizient der Regressionslinie. Der (ganzzahlige) Wert COUNT ist die Anzahl der Produkte in jedem Kanal, für den sowohl die verkauften Mengen als auch die Listenpreisdaten verfügbar sind. Lineare Algebra Lineare Algebra ist ein Zweig der Mathematik mit einer breiten Palette von praktischen Anwendungen. Viele Bereiche haben Aufgaben, die durch lineare Algebra ausgedrückt werden können, und hier einige Beispiele aus verschiedenen Bereichen: Statistik (multiple lineare Regression und prinzipielle Komponentenanalyse), Data Mining (Clustering und Klassifikation), Bioinformatik (Analyse von Microarray-Daten), Operations Research (Supply Chain und andere Optimierungsprobleme), Ökonometrie (Analyse der Verbraucherbedarfsdaten) und Finanzen (Asset Allocation). Verschiedene Bibliotheken für lineare Algebra sind frei verfügbar für jedermann zu verwenden. Oracles UTLNLA-Paket stellt Matrix-PLSQL-Datentypen und Wrapper-PLSQL-Unterprogramme für zwei der beliebtesten und robustesten dieser Bibliotheken BLAS und LAPACK zur Verfügung. Lineare Algebra hängt von der Matrixmanipulation ab. Die Durchführung von Matrixmanipulationen in PLSQL in der Vergangenheit erforderte das Erfinden einer Matrixdarstellung basierend auf PLSQLs nativen Datentypen und dann das Schreiben von Matrixmanipulationsroutinen von Grund auf neu. Dies erforderte einen erheblichen Programmieraufwand und die Leistung der resultierenden Implementierung war begrenzt. Wenn Entwickler wählten, Daten an externe Pakete zur Verarbeitung zu senden, anstatt ihre eigenen Routinen zu erstellen, könnte eine Datenübertragung hin und her zeitraubend sein. Mit dem UTLNLA-Paket können Daten in Oracle bleiben, der Programmieraufwand entfernt und eine schnelle Implementierung ermöglicht werden. Beispiel 21-19 Lineare Algebra Hier ist ein Beispiel dafür, wie Oracles lineare Algebra-Unterstützung für Business Analysis verwendet werden könnte. Es ruft eine multiple lineare Regressionsanwendung auf, die mit dem UTLNLA-Paket erstellt wurde. Die Multiregressionsanwendung wird in einem Objekt namens OLSRegression implementiert. Beachten Sie, dass Beispieldateien für das OLS-Regression-Objekt in ORACLEHOMEplsqldemo gefunden werden können. Betrachten Sie das Szenario eines Einzelhändlers, der die Wirksamkeit seines Marketingprogramms analysiert. Jeder seiner Filialen verteilt sein Marketingbudget über folgende mögliche Programme: Medienwerbung (Medien), Promotions (promo), Rabattgutscheine (disct) und Direct Mailer (dmail). Die Regressionsanalyse bildet eine lineare Beziehung zwischen der Menge der Verkäufe, die ein durchschnittliches Geschäft in einem gegebenen Jahr (Verkäufe) und den Ausgaben für die vier Bestandteile des Marketing-Programms hat. Angenommen, die Marketingdaten werden in der folgenden Tabelle gespeichert: Dann können Sie das folgende lineare Verkaufsmodell mit Hilfe von Koeffizienten erstellen: Dieses Modell kann als die folgende Sicht implementiert werden, die sich auf das OLS-Regressionsobjekt bezieht: Mit dieser Ansicht ein Marketing Programm-Manager kann eine Analyse durchführen, wie Ist dieses Vertriebs-Marketing-Modell vernünftig für das Jahr 2004 Daten Das heißt, ist die Mehrfachkorrelation größer als einige akzeptable Wert, sagen, 0,9 Die SQL für eine solche Abfrage könnte wie folgt sein: Sie könnten auch Fragen wie z. B. Was ist der erwartete Umsatz Umsatz eines Filialen ohne Marketing-Programme im Jahr 2003 oder Welche Komponente des Marketing-Programm war die effektivste in 2004 Das heißt, ein Dollar-Anstieg in dem Programm produziert die größte erwartete Zunahme in Sales Weitere Informationen zur Verwendung des UTLNLA-Pakets und der linearen Algebra finden Sie unter Oracle Database PLSQL Packages and Types Reference. Häufige Itemsets Anstatt zu zählen, wie oft ein bestimmtes Ereignis auftritt (z. B. wie oft jemand Milch im Lebensmittelgeschäft gekauft hat), kann es nützlich sein, zu zählen, wie oft mehrere Ereignisse zusammen auftreten (z. B. wie oft jemand beide Milch gekauft hat) Und Getreide zusammen an der Supermarkt). Sie können diese mehrere Ereignisse mit einem so genannten "häufigen Itemset" zählen, das, wie der Name schon sagt, eine Menge von Elementen ist. Einige Beispiele für Postenets könnten alle Produkte sein, die ein bestimmter Kunde in einer einzigen Reise zum Lebensmittelgeschäft gekauft hat (üblicherweise als Marktkorb bezeichnet), die Webseiten, auf die ein Benutzer in einer einzigen Sitzung zugreift, oder die Finanzdienstleistungen, Kunde nutzt. Die praktische Motivation für die Verwendung eines häufigen Itemset ist es, diejenigen Itemsets zu finden, die am häufigsten auftreten. Wenn Sie analysieren, ein Lebensmittelgeschäfte Point-of-Sale-Daten, könnten Sie zum Beispiel entdecken, dass Milch und Bananen sind die am häufigsten gekauft Paar von Elementen. Häufige Postenets sind damit seit vielen Jahren in Business-Intelligence-Umgebungen verwendet worden, wobei die gebräuchlichste für die Marktkorb-Analyse im Einzelhandel ist. Häufige Itemset-Berechnungen werden mit der Datenbank integriert, die über relationale Tabellen verfügt und über SQL aufgerufen wird. Diese Integration bietet die folgenden wesentlichen Vorteile: Anwendungen, die bisher auf häufige Itemset-Operationen angewiesen waren, profitieren nun von einer deutlich verbesserten Performance sowie einer einfacheren Implementierung. SQL-basierte Anwendungen, die bisher keine häufigen Postenets verwendet haben, können nun leicht erweitert werden, um diese Funktionalität nutzen zu können. Häufige Itemsets-Analyse wird mit dem PLSQL-Paket DBMSFREQUENTITEMSETS durchgeführt. Weitere Informationen finden Sie unter Oracle Database PLSQL Packages and Types Reference. Darüber hinaus gibt es ein Beispiel für häufige Postenets Verwendung in Häufigen Postenets. Weitere statistische Funktionen Oracle stellt eine Reihe statistischer SQL-Funktionen und ein Statistikpaket, DBMSSTATFUNCS, vor. In diesem Abschnitt werden einige der neuen Funktionen zusammen mit der grundlegenden Syntax aufgelistet. Beschreibende Statistik Sie können folgende deskriptive Statistik berechnen: Median eines Datensatzes Sie können folgende parametrische Statistik berechnen: Spearmans rho Koeffizient Kendalls tau-b Koeffizient Zusätzlich zu den Funktionen verfügt diese Version über ein neues PLSQL-Paket, DBMSSTATFUNCS. Es enthält die beschreibende statistische Funktion ZUSAMMENFASSUNG zusammen mit Funktionen zur Unterstützung der Verteilungsanpassung. Die SUMMARY-Funktion fasst eine numerische Spalte einer Tabelle mit einer Vielzahl von deskriptiven Statistiken zusammen. Die fünf Verteilungsanpassungsfunktionen unterstützen normale, einheitliche, Weibull-, Poisson - und Exponentialverteilungen. WIDTHBUCKET-Funktion Die WIDTHBUCKET-Funktion gibt für einen gegebenen Ausdruck die Bucket-Nummer zurück, nach der das Ergebnis dieses Ausdrucks zugewiesen wird. Sie können mit dieser Funktion Gleichheitshistogramme erzeugen. Equiwidth-Histogramme unterteilen Datensätze in Buckets, deren Intervallgröße (höchster Wert zum niedrigsten Wert) gleich ist. Die Anzahl der Zeilen, die von jedem Eimer gehalten werden, variiert. Eine verwandte Funktion, NTILE. Schafft gleich große Schaufeln. Equiwidth-Histogramme können nur für numerische, Datums - oder Datetime-Typen erzeugt werden. Die ersten drei Parameter sollten also alle numerischen Ausdrücke oder alle Datumsausdrücke sein. Andere Ausdrücke sind nicht erlaubt. Wenn der erste Parameter NULL ist. Das Ergebnis ist NULL. Wenn der zweite oder dritte Parameter NULL ist. Wird eine Fehlermeldung zurückgegeben, da ein NULL-Wert keinen Endpunkt (oder einen beliebigen Punkt) für einen Bereich in einer Datums - oder numerischen Wertdimension angibt. Der letzte Parameter (Anzahl der Buckets) sollte ein numerischer Ausdruck sein, der einen positiven Integerwert 0, NULL auswertet. Oder ein negativer Wert führt zu einem Fehler. Die Buckets sind von 0 bis (n 1) nummeriert. Bucket 0 enthält die Anzahl der Werte, die kleiner als das Minimum sind. Bucket (n 1) enthält die Anzahl der Werte, die größer oder gleich dem maximalen angegebenen Wert sind. WIDTHBUCKET Syntax Das WIDTHBUCKET nimmt vier Ausdrücke als Parameter an. Der erste Parameter ist der Ausdruck, für den das equiwidth-Histogramm gilt. Der zweite und dritte Parameter sind Ausdrücke, die die Endpunkte des akzeptablen Bereichs für den ersten Parameter bezeichnen. Der vierte Parameter bezeichnet die Anzahl der Buckets. Betrachten Sie die folgenden Daten von Tischkunden. Dass die Kreditlimiten von 17 Kunden zeigt. Diese Daten werden in der Abfrage in Beispiel 21-20 gesammelt. In der Tabelle Kunden. Die Spalte custcreditlimit enthält Werte zwischen 1500 und 15000, und wir können die Werte zu vier Equiwidth Buckets, nummeriert von 1 bis 4, mit WIDTHBUCKET (custcreditlimit, 0, 20000, 4) zuweisen. Idealerweise ist jede Schaufel ein geschlossenes Intervall der reellen Zahlenlinie, z. B. ist die Schaufelzahl 2 Scores zwischen 5000.0000 und 9999.9999 zugeordnet. Manchmal mit 5000, 10000 bezeichnet), um anzuzeigen, daß 5.000 in dem Intervall enthalten sind und 10.000 ausgeschlossen sind. Um Werte außerhalb des Bereichs 0, 20.000 zu erfassen, werden Werte kleiner als 0 einer bezeichneten Unterlaufschaufel mit der Nummer 0 zugewiesen und Werte größer oder gleich 20.000 einer bezeichneten Überlaufschaufel, die mit 5 (num Schaufeln 1 Im Algemeinen). Siehe Abbildung 21-3 für eine grafische Darstellung, wie die Buckets zugeordnet sind. Abbildung 21-3 Bucket-Zuweisungen Sie können die Schranken in umgekehrter Reihenfolge angeben, zB WIDTHBUCKET (custcreditlimit 20000. 0. 4). Wenn die Schranken umgekehrt werden, sind die Buckets offen-geschlossene Intervalle. In diesem Beispiel ist die Schaufelzahl 1 (15000,20000, die Schaufelzahl 2 ist (10000,15000 und die Schaufelzahl 4, (0, 5000. Die Überlaufschaufel wird mit 0 (20000. unendlich) und die Unterlaufschaufel numeriert Beispiel 21-20 WIDTHBUCKET In der folgenden Abfrage werden die Bucket-Nummern für die Kreditlimiten in der Kundentabelle für beide Fälle angezeigt, in denen die Option " Benutzerdefinierte Aggregatfunktionen Oracle bietet eine Möglichkeit zur Erstellung eigener Funktionen, sogenannte benutzerdefinierte Aggregatfunktionen, die in Programmiersprachen wie PLSQL geschrieben werden , Java und C und können als analytische Funktionen oder Aggregate in materialisierten Ansichten verwendet werden Weitere Informationen zu Syntax und Einschränkungen finden Sie im Oracle Database Data Cartridge Developers Guide Die Vorteile dieser Funktionen sind: Hochkomplexe Funktionen können mit einer vollständigen Programmierung programmiert werden Verfahrenssprache. Höhere Skalierbarkeit als andere Techniken, wenn benutzerdefinierte Funktionen für die Parallelverarbeitung programmiert werden. Objektdatentypen können verarbeitet werden. Als einfaches Beispiel für eine benutzerdefinierte Aggregatfunktion ist die Skew-Statistik zu betrachten. Diese Berechnung mißt, wenn ein Datensatz eine schiefe Verteilung um seinen Mittelwert hat. Es wird Ihnen sagen, wenn ein Schwanz der Verteilung ist deutlich größer als die anderen. Wenn Sie ein benutzerdefiniertes Aggregat namens udskew erstellt und auf die Kreditlimitdaten des vorherigen Beispiels angewendet haben, können die SQL-Anweisung und die Ergebnisse wie folgt aussehen: Bevor Sie benutzerdefinierte Aggregatfunktionen erstellen, sollten Sie prüfen, ob Ihre Anforderungen erfüllt werden können In regelmäßigen SQL. Viele komplexe Berechnungen sind direkt in SQL möglich, insbesondere durch Verwendung des CASE-Ausdrucks. Der Aufenthalt mit regulärem SQL ermöglicht eine einfachere Entwicklung, und viele Abfrageoperationen sind in SQL bereits gut parallelisiert. Selbst das frühere Beispiel, die Skew-Statistik, kann mit Standard, wenn auch langwierig, SQL erstellt werden. CASE-Ausdrücke Oracle unterstützt jetzt einfache und durchsuchte CASE-Anweisungen. CASE-Anweisungen sind ähnlich im Sinne der DECODE-Anweisung, aber sie bieten mehr Flexibilität und logische Macht. Sie sind auch leichter zu lesen als herkömmliche DECODE-Anweisungen und bieten auch eine bessere Leistung. Sie werden häufig beim Brechen von Kategorien in Eimer wie Alter (z. B. 20-29, 30-39, und so weiter) verwendet. Die Syntax für einfache CASE-Anweisungen lautet: Einfache CASE-Ausdrücke testen, ob der expr - Wert gleich dem comparisonexpr ist. Die Syntax für gesuchte CASE-Anweisungen lautet: Sie können jede Art von Bedingung in einem gesuchten CASE-Ausdruck verwenden, nicht nur einen Gleichheitstest. Sie können nur 255 Argumente und jedes WHEN angeben. DANN Paar zählt als zwei Argumente. Um diese Grenze zu überschreiten, können Sie CASE-Ausdrücke verschachteln, so dass das returnexpr selbst ein CASE-Ausdruck ist. Beispiel 21-21 CASE Angenommen, Sie wollten das durchschnittliche Gehalt aller Mitarbeiter im Unternehmen finden. Wenn ein Mitarbeitergehalt weniger als 2000 ist, möchten Sie, dass die Abfrage 2000 stattdessen verwendet. Ohne CASE-Anweisung können Sie diese Abfrage folgendermaßen schreiben: Beachten Sie, dass dies gegen das hr-Beispielschema läuft. In diesem ist foo eine Funktion, die ihre Eingabe zurückgibt, wenn die Eingabe größer als 2000 ist und gibt ansonsten 2000 zurück. Die Abfrage hat Auswirkungen auf die Leistung, da sie eine Funktion für jede Zeile aufrufen muss. Das Schreiben von benutzerdefinierten Funktionen kann auch die Entwicklungslast hinzufügen. Mit CASE-Ausdrücken in der Datenbank ohne PLSQL kann diese Abfrage umgeschrieben werden als: Mit einem CASE-Ausdruck können Sie vermeiden, benutzerdefinierte Funktionen zu entwickeln und können auch schneller ausgeführt werden. Beispiel 21-22 CASE für die Aggregation von unabhängigen Subsets Die Verwendung von CASE innerhalb von Aggregatfunktionen ist eine bequeme Möglichkeit, Aggregate auf mehreren Teilmengen von Daten auszuführen, wenn eine einfache GROUP BY nicht ausreicht. Beispielsweise könnte das vorhergehende Beispiel mehrere AVG-Spalten in seiner SELECT-Liste enthalten haben, jedes mit seinem eigenen CASE-Ausdruck. Vielleicht haben wir eine Abfrage finden die durchschnittliche Gehalt für alle Mitarbeiter in den Gehaltsspannen 0-2000 und 2000-5000 gehabt haben. Es würde folgendermaßen aussehen: Obwohl diese Abfrage die Aggregate unabhängiger Untermengen-Daten in separate Spalten platziert, können wir die Aggregate als Zeilen einer einzelnen Spalte anzeigen, indem wir der GROUP BY-Klausel einen CASE-Ausdruck hinzufügen. Der nächste Abschnitt zeigt die Flexibilität dieses Ansatzes mit zwei Ansätzen zur Erstellung von Histogrammen mit CASE. Erstellen von Histogrammen mit benutzerdefinierten Buckets Sie können die CASE-Anweisung verwenden, wenn Sie Histogramme mit benutzerdefinierten Buckets (sowohl in der Anzahl der Buckets als auch in der Breite der einzelnen Bucket) erhalten möchten. Es folgen zwei Beispiele für Histogramme, die mit CASE-Anweisungen erstellt wurden. Im ersten Beispiel werden die Histogramm-Summen in mehreren Spalten angezeigt und eine einzelne Zeile wird zurückgegeben. Im zweiten Beispiel wird das Histogramm mit einer Label-Spalte und einer einzelnen Spalte für Summen dargestellt, und mehrere Zeilen werden zurückgegeben. Beispiel 21-23 Histogramm Beispiel 1 Beispiel 21-24 Histogramm Beispiel 2 Datenverdichtung für die Meldung Daten werden normalerweise in spärlicher Form gespeichert. Das heißt, wenn kein Wert für eine gegebene Kombination von Dimensionswerten existiert, existiert keine Zeile in der Faktentabelle. Sie können die Daten jedoch in dichter Form anzeigen, wobei Zeilen für alle Kombinationen von Bemaßungswerten angezeigt werden, auch wenn keine Faktendaten für sie vorhanden sind. Wenn beispielsweise ein Produkt während eines bestimmten Zeitraums nicht verkauft wurde, können Sie das Produkt weiterhin für diesen Zeitraum sehen, wenn der Verkaufswert daneben liegt. Darüber hinaus können Zeitreihenberechnungen am einfachsten durchgeführt werden, wenn Daten entlang der Zeitdimension dicht sind. Dies liegt daran, dass dichte Daten eine konsistente Anzahl von Zeilen für jede Periode füllen, was wiederum es einfach macht, die analytischen Fensterfunktionen mit physischen Offsets zu verwenden. Datenverdichtung ist der Prozess der Umwandlung von spärlichen Daten in dichte Form. Um das Problem der Sparsität zu überwinden, können Sie eine partitionierte äußere Verknüpfung verwenden, um die Lücken in einer Zeitreihe oder einer anderen Dimension zu füllen. Eine solche Verknüpfung erweitert die herkömmliche äußere Verknüpfungssyntax, indem die äußere Verknüpfung auf jede in einer Abfrage definierte logische Partition angewendet wird. Oracle partitioniert die Zeilen in Ihrer Abfrage auf der Grundlage des in der PARTITION BY-Klausel angegebenen Ausdrucks logisch. Das Ergebnis einer partitionierten äußeren Verknüpfung ist eine UNION der äußeren Verknüpfungen von jeder der Partitionen in der logisch partitionierten Tabelle mit der Tabelle auf der anderen Seite der Verknüpfung. Beachten Sie, dass Sie diese Art von Verknüpfung verwenden können, um die Lücken in beliebigen zu füllen Dimension, nicht nur die Zeitdimension. Die meisten Beispiele beziehen sich hier auf die Zeitdimension, da sie die am häufigsten verwendete Dimension für Vergleiche ist. Partition Join Syntax Die Syntax für partitionierte äußere Verknüpfung erweitert die ANSI SQL JOIN-Klausel um den Ausdruck PARTITION BY, gefolgt von einer Ausdrucksliste. Die Ausdrücke in der Liste geben die Gruppe an, auf die die äußere Verknüpfung angewendet wird. Im Folgenden finden Sie die beiden Syntaxformen, die normalerweise für partitionierte äußere Verknüpfungen verwendet werden: Beachten Sie, dass FULL OUTER JOIN nicht mit einer partitionierten äußeren Verknüpfung unterstützt wird. Beispiel von Sparse-Daten Eine typische Situation mit einer spärlichen Dimension wird im folgenden Beispiel gezeigt, das die wöchentlichen Verkäufe und den Jahresabschluss für das Produkt Bounce für die Wochen 20-30 in den Jahren 2000 und 2001 berechnet Erwarten würde 22 Reihen von Daten (11 Wochen jeweils von 2 Jahren), wenn die Daten waren dicht. Allerdings erhalten wir nur 18 Zeilen, weil die Wochen 25 und 26 im Jahr 2000 und die Wochen 26 und 28 im Jahr 2001 fehlen. Füllen von Datenlücken Wir können die spärlichen Daten der vorhergehenden Abfrage nehmen und eine partitionierte äußere Verknüpfung mit einer dichten Menge von Zeit durchführen Daten. In der folgenden Abfrage übergeben wir unsere ursprüngliche Abfrage als v und wir wählen Daten aus der Zeittabelle, die wir alias als t. Hier werden 22 Zeilen abgerufen, da es keine Lücken in der Reihe gibt. Die vier hinzugefügten Zeilen haben jeweils 0, wenn der Verkaufswert auf 0 gesetzt wird, indem die NVL-Funktion verwendet wird. Beachten Sie, dass in dieser Abfrage eine WHERE-Bedingung für Wochen zwischen 20 und 30 in der Inline-Ansicht für die Zeitdimension platziert wurde. Dies wurde eingeführt, um die Ergebnismenge klein zu halten. Füllen von Lücken in zwei Dimensionen N-dimensionale Daten werden typischerweise als ein dichter zweidimensionaler Querstreifen von (n - 2) Seitenabmessungen angezeigt. Dies erfordert, dass alle Bemaßungswerte für die beiden Dimensionen, die in der Quer-Registerkarte angezeigt werden, eingegeben werden. Im Folgenden ist ein anderes Beispiel, bei dem die partitionierte äußere Verknüpfungsfunktion zum Befüllen der Lücken auf zwei Dimensionen verwendet werden kann: In dieser Abfrage die WITH-Unterabfrage Factoring-Klausel V1 fasst die Umsatzdaten auf Produkt-, Länder - und Jahresebene zusammen. Dieses Ergebnis ist spärlich, aber Benutzer können alle Länder-, Jahr-Kombinationen für jedes Produkt sehen. Um dies zu erreichen, nehmen wir jede Partition von v1 basierend auf Produktwerten und äußere verbinden sie auf der Land-Dimension zuerst. Dieses gibt uns alle Werte des Landes für jedes Produkt. Wir nehmen dann dieses Ergebnis und partitionieren es auf Produkt-und Landeswerte und dann äußere verbinden sie auf Zeitdimension. Damit erhalten Sie für jede Produkt - und Länderkombination alle Zeitwerte. Füllen von Lücken in einer Inventartabelle In einer Inventartabelle wird typischerweise eine Menge von Einheiten angezeigt, die für verschiedene Produkte verfügbar sind. Diese Tabelle ist spärlich: sie speichert nur eine Zeile für ein Produkt, wenn es ein Ereignis gibt. Für eine Verkaufstabelle ist die Veranstaltung ein Verkauf, und für die Inventartabelle ist das Ereignis eine Mengenänderung, die für ein Produkt verfügbar ist. Beachten Sie zum Beispiel die folgende Inventartabelle: Die Inventartabelle verfügt nun über die folgenden Zeilen: Für Berichtszwecke können Benutzer diese Inventardaten anders sehen. Sie können z. B. alle Werte der Zeit für jedes Produkt sehen. Dies kann durch partitionierte äußere Verknüpfung erreicht werden. Außerdem können Benutzer für die neu eingefügten Zeilen fehlender Zeitperioden die Werte für Mengeneinheitsspalten sehen, die von der aktuellsten vorhandenen Zeitdauer übertragen werden sollen. Letzteres kann mit dem analytischen Fensterfunktion-LASTVALUE-Wert erreicht werden. Hier ist die Abfrage und die gewünschte Ausgabe: Die innere Abfrage berechnet eine partitionierte äußere Verknüpfung auf Zeit innerhalb jedes Produkts. Die innere Abfrage verdichtet die Daten auf der Zeitdimension (dh die Zeitdimension hat nun eine Zeile für jeden Wochentag). Für die neu hinzugefügten Zeilen hat die Maßsäulenmenge jedoch Nullen (siehe die Ausgabe in der Spaltenmenge in den folgenden Ergebnissen: Die äußere Abfrage verwendet die analytische Funktion LASTVALUE.) Bei Anwendung dieser Funktion werden die Daten nach Produkt partitioniert und die Daten auf der (Timeid) Für jede Zeile findet die Funktion aufgrund der Option IGNORE NULLS, die Sie sowohl mit LASTVALUE als auch mit FIRSTVALUE verwenden können, den letzten Nicht-Nullwert im Fenster. In der Spalte repequentity sehen wir die gewünschte Ausgabe Die folgende Ausgabe: Berechnen von Datenwerten zum Füllen von Lücken Beispiele im vorherigen Abschnitt veranschaulichen, wie partitionierte äußere Verknüpfung verwendet wird, um Lücken in einer oder mehreren Dimensionen zu füllen. Die Ergebnismengen, die durch partitionierte äußere Verknüpfung erzeugt werden, haben jedoch Nullwerte für Spalten, die nicht in enthalten sind Die PARTITION BY-Liste, die normalerweise analytische SQL-Funktionen verwenden, um diese Nullwerte durch einen Nicht-Nullwert zu ersetzen. Beispielsweise berechnet die folgende Abfrage monatliche Summen für Produkte 64 MB Speicherkarte und DVD-R Discs (Produkt-IDs 122 und 136) für das Jahr 2000. Es verwendet partitionierte äußere Verknüpfung, um Daten für alle Monate zu verdichten. Für die fehlenden Monate wird dann die analytische SQL-Funktion AVG verwendet, um die Umsätze und Einheiten als den Durchschnitt der Monate zu errechnen, in denen das Produkt verkauft wurde. Wenn Sie in SQLPlus arbeiten, werden die folgenden beiden Befehle die Spaltenüberschriften umreißen, um die Ergebnisse besser lesbar zu machen: Zeitreihenberechnungen für Densified Data Densificatio n ist nicht nur für Berichtszwecke gedacht. Es ermöglicht auch bestimmte Arten von Berechnungen, insbesondere Zeitreihenberechnungen. Zeitreihenberechnungen sind einfacher, wenn Daten entlang der Zeitdimension dicht sind. Dichte Daten weisen eine konsistente Anzahl von Zeilen für jede Zeitperiode auf, die es wiederum einfach macht, analytische Fensterfunktionen mit physischen Offsets zu verwenden. Um dies zu illustrieren, nehmen wir zunächst das Beispiel zum Füllen von Lücken in Daten. Und fügen Sie eine analytische Funktion zu dieser Abfrage hinzu. In der folgenden erweiterten Version berechnen wir wöchentlich jährliche Verkäufe neben dem wöchentlichen Verkauf. Die NULL-Werte, die die partitionierte äußere Verknüpfung bei der Herstellung der Zeitreihen dicht einfügt, werden auf die übliche Weise behandelt: Die SUM-Funktion behandelt sie als 0s. Period-to-Period-Vergleich für eine Zeitstufe: Beispiel Wie verwenden wir diese Funktion, um Werte über Zeiträume hinweg zu vergleichen. Im Einzelnen: Wie berechnen wir einen Vergleichsvergleich im Vergleich zum Vorjahr auf der Wochesebene Die folgende Abfrage gibt dieselbe Zeile zurück , Für jedes Produkt den Jahresabschluss für jede Woche von 2001 mit dem von 2000. Beachten Sie, dass wir in diesem Beispiel mit einer WITH-Klausel beginnen. Dies verbessert die Lesbarkeit der Abfrage und lässt uns auf den partitionierten äußeren Join fokussieren. Wenn Sie in SQLPlus arbeiten, wickelt der folgende Befehl die Spaltenüberschriften für eine bessere Lesbarkeit der Ergebnisse: In der FROM-Klausel der Inline-Ansicht densesales. Verwenden wir eine partitionierte äußere Verknüpfung der Aggregatansicht v und der Zeitansicht t, um Lücken in den Verkaufsdaten entlang der Zeitdimension zu füllen. Die Ausgabe der partitionierten äußeren Verknüpfung wird dann durch die analytische Funktion SUM verarbeitet. OVER, um den wöchentlichen Jahresabschluss zu berechnen (die weeklyytdsales Spalte). So berechnet die Ansicht densesales die Jahresabschlussdaten für jede Woche, einschließlich der fehlenden Summenansichten. Die Inline-Ansicht yearoveryearsales berechnet dann den vorjährigen wöchentlichen Jahresabschluss mit der LAG-Funktion. Die LAG-Funktion weeklyytdsalesprioryear gibt eine PARTITION BY-Klausel an, die Zeilen für die gleiche Woche der Jahre 2000 und 2001 in einer einzigen Partition paaren. Wir übergeben dann einen Offset von 1 an die LAG-Funktion, um das wöchentliche Jahr zu erhalten, um die Verkäufe für das vorherige Jahr zu erreichen. Der äußerste Abfrageblock wählt Daten von yearoveryearsales mit der Bedingung yr 2001. und so gibt die Abfrage für jedes Produkt seine wöchentliche zurück Jahr-to-date-Umsatz in den angegebenen Wochen der Jahre 2001 und 2000. Period-to-Period Vergleich für mehrere Zeitstufen: Beispiel Während das vorherige Beispiel zeigt uns eine Möglichkeit, Vergleiche für ein einziges Zeitniveau zu schaffen, wäre es noch mehr Nützlich, um mehrere Zeitniveaus in einer einzelnen Abfrage zu behandeln. Zum Beispiel könnten wir den Umsatz gegenüber dem Vorjahreszeitraum auf Jahr, Quartal, Monat und Tagestufe vergleichen. Wie können wir eine Abfrage erstellen, die einen jährlichen Vergleich des Jahresabschlusses für alle Ebenen unserer Zeithierarchie durchführt. Wir werden diese Schritte in mehreren Schritten durchführen. Das Ziel ist eine einzelne Abfrage mit Vergleichen am Tag, Woche, Monat, Quartal und Jahr. Die Schritte sind wie folgt: Wir erstellen eine Ansicht namens cubeprodtime. Die einen hierarchischen Würfel von Umsatz aggregiert über Zeiten und Produkte hält. Dann erstellen wir eine Ansicht der Zeitdimension, die als Kante des Würfels verwendet werden soll. Die Zeitkante, die einen vollständigen Satz von Daten enthält, wird partitioniert mit den spärlichen Daten in der Ansicht cubeprodtime verbunden. Schließlich, für maximale Leistung, erstellen wir eine materialisierte Ansicht, mvprodtime. Gebaut mit der gleichen Definition wie cubeprodtime. Weitere Informationen zu hierarchischen Cubes finden Sie unter Kapitel 20, SQL für Aggregation in Data Warehouses. Die materialisierte Ansicht wird in Schritt 1 im folgenden Abschnitt definiert. Schritt 1 Erstellen Sie die hierarchische Cube-Ansicht Die materialisierte Ansicht, die im Folgenden dargestellt wird, kann in Ihrem System vorhanden sein, wenn nicht, erstellen Sie sie jetzt. Wenn Sie es generieren müssen, beachten Sie, dass wir die Abfrage auf nur zwei Produkte beschränken, um die Bearbeitungszeit kurz zu halten: Da diese Ansicht auf zwei Produkte beschränkt ist, gibt sie knapp über 2200 Zeilen zurück. Beachten Sie, dass die Spalte HierarchicalTime Stringdarstellungen von Zeit aus allen Ebenen der Zeithierarchie enthält. Der CASE-Ausdruck, der für die HierarchicalTime-Spalte verwendet wird, fügt eine Markierung (0, 1.) jeder Datumszeichenfolge hinzu, um die Zeitstufe des Wertes anzugeben. A 0 steht für das Jahr, 1 für Quartale, 2 für Monate und 3 für Tag. Beachten Sie, dass die GROUP BY-Klausel eine verkettete ROLLUP ist, die die Rollup-Hierarchie für die Zeit - und Produktdimensionen angibt. Die GROUP BY-Klausel bestimmt den hierarchischen Cube-Inhalt. Schritt 2 Erstellen Sie die Ansicht edgetime, die eine vollständige Menge von Datumswerten ist Edgetime ist die Quelle für das Ausfüllen von Zeitlücken im hierarchischen Cube mit einem partitionierten äußeren Join. Die Spalte HierarchicalTime in edgetime wird in einer partitionierten Verknüpfung mit der Spalte HierarchicalTime in der View cubeprodtime verwendet. Die folgende Anweisung definiert edgetime: Schritt 3 Erstellen der materialisierten Ansicht mvprodtime zur Unterstützung schnellerer Performance Die materialisierte Viewdefinition ist ein Duplikat der zuvor definierten View cubeprodtime. Da es sich um eine doppelte Abfrage handelt, werden Verweise auf cubeprodtime neu geschrieben, um die materialisierte Ansicht mvprodtime zu verwenden. Die folgenden Materialisierungen können in Ihrem System vorhanden sein, wenn nicht, erstellen Sie es jetzt. Wenn Sie es generieren müssen, beachten Sie bitte, dass wir die Abfrage auf nur zwei Produkte beschränken, um die Bearbeitungszeit kurz zu halten. Schritt 4 Erstellen der Vergleichsabfrage Wir haben nun die Stufe für unsere Vergleichsabfrage gesetzt. Wir können Periodenvergleichsberechnungen auf allen Zeitniveaus erhalten. Es erfordert das Anwenden von analytischen Funktionen auf einen hierarchischen Würfel mit dichten Daten entlang der Zeitdimension. Einige der Berechnungen, die wir für jedes Zeitniveau erreichen können, sind: Summe der Verkäufe für vorherigen Zeitraum auf allen Zeitniveaus. Umsatzabweichung gegenüber Vorjahr. Summe des Umsatzes im gleichen Zeitraum vor einem Jahr auf allen Ebenen der Zeit. Umsatzveränderung im Vergleich zum Vorjahreszeitraum. Im folgenden Beispiel werden alle vier Berechnungen durchgeführt. Es verwendet eine partitionierte äußere Verknüpfung der Views cubeprodtime und edgetime, um eine Inline-Ansicht von dichten Daten namens densecubeprodtime zu erstellen. Die Abfrage verwendet dann die LAG-Funktion auf dieselbe Weise wie das vorherige einstufige Beispiel. Die äußere WHERE-Klausel gibt die Zeit auf drei Ebenen an: die Tage August 2001, den gesamten Monat und das gesamte dritte Quartal 2001. Beachten Sie, dass die letzten beiden Zeilen der Ergebnisse die Monats - und Quartalsniveau-Aggregationen enthalten Die Ergebnisse leichter zu lesen, wenn Sie SQLPlus verwenden, sollten die Spaltenüberschriften mit den folgenden Befehlen angepasst werden. The commands will fold the column headings to reduce line length: Here is the query comparing current sales to prior and year ago sales: The first LAG function ( salespriorperiod ) partitions the data on gidp. cat. subcat. prod. gidt and orders the rows on all the time dimension columns. It gets the sales value of the prior period by passing an offset of 1. The second LAG function ( salessameperiodprioryear ) partitions the data on additional columns qtrnum. monnum. and daynum and orders it on yr so that, with an offset of 1, it can compute the year ago sales for the same period. The outermost SELECT clause computes the variances. Creating a Custom Member in a Dimension: Example In many OLAP tasks, it is helpful to define custom members in a dimension. For instance, you might define a specialized time period for analyses. You can use a partitioned outer join to temporarily add a member to a dimension. Note that the new SQL MODEL clause is suitable for creating more complex scenarios involving new members in dimensions. See Chapter 22, SQL for Modeling for more information on this topic. As an example of a task, what if we want to define a new member for our time dimension We want to create a 13th member of the Month level in our time dimension. This 13th month is defined as the summation of the sales for each product in the first month of each quarter of year 2001. The solution has two steps. Note that we will build this solution using the views and tables created in the prior example. Two steps are required. First, create a view with the new member added to the appropriate dimension. The view uses a UNION ALL operation to add the new member. To query using the custom member, use a CASE expression and a partitioned outer join. Our new member for the time dimension is created with the following view: In this statement, the view timec is defined by performing a UNION ALL of the edgetime view (defined in the prior example) and the user-defined 13th month. The gidt value of 8 was chosen to differentiate the custom member from the standard members. The UNION ALL specifies the attributes for a 13th month member by doing a SELECT from the DUAL table. Note that the grouping id, column gidt. is set to 8, and the quarter number is set to 5. Then, the second step is to use an inline view of the query to perform a partitioned outer join of cubeprodtime with timec. This step creates sales data for the 13th month at each level of product aggregation. In the main query, the analytic function SUM is used with a CASE expression to compute the 13th month, which is defined as the summation of the first months sales of each quarter. The SUM function uses a CASE to limit the data to months 1, 4, 7, and 10 within each year. Due to the tiny data set, with just 2 products, the rollup values of the results are necessarily repetitions of lower level aggregations. For more realistic set of rollup values, you can include more products from the Game Console and Y Box Games subcategories in the underlying materialized view. Scripting on this page enhances content navigation, but does not change the content in any way. The Matrix and Solving Systems with Matrices This section covers: Introduction to the Matrix A matrix (plural matrices ) is sort of like a box of information where you are keeping track of things both right and left ( columns ), and up and down ( rows ). Usually a matrix contains numbers or algebraic expressions . You may have heard matrices called arrays . especially in computer science. As an example, if you had three sisters, and you wanted an easy way to store their age and number of pairs of shoes, you could store this information in a matrix. The actual matrix is inside and includes the brackets: Matrices are called multi-dimensional since we have data being stored in different directions in a grid. The dimensions of this matrix are 2 x 3 or 2 by 3, since we have 2 rows and 3 columns. (You always go down first, and then over to get the dimensions of the matrix). Again, matrices are great for storing numbers and variables and also great for solving systems of equations, which well see later. Each number or variable inside the matrix is called an entry or element . and can be identified by subscripts . For example, for the matrix above, Brett would be identified as , since its on the 2 nd row and its the 1 st entry. Adding and Subtracting Matrices Lets look at a matrix that contains numbers and see how we can add and subtract matrices. Lets say youre in avid reader, and in June, July, and August you read fiction and non-fiction books, and magazines, both in paper copies and online. You want to keep track of how many different types of books and magazines you read, and store that information in matrices. Here is that information, and how it would look in matrix form: We can add matrices if the dimensions are the same since the three matrices are all 3 by 2, we can add them. For example, if we wanted to know the total number of each type of bookmagazine we read, we could add each of the elements to get the sum: Thus we could see that we read 6 paper fiction, 9 online fiction, 6 paper non-fiction, 5 online non-fiction books, and 13 paper and 14 online magazines. We could also subtract matrices this same way. If we wanted to see how many book and magazines we would have read in August if we had doubled what we actually read, we could multiply the August matrix by the number 2. This is called matrix scalar multiplication a scalar is just a single number that we multiply with every entry. Note that this is not the same as multiplying 2 matrices together (which we8217ll get to next): Multiplying Matrices Multiplying matrices is a little trickier. First of all, you can only multiply matrices if the dimensions 8220match8221 the second dimension (columns) of the first matrix has to match the first dimension (rows) of the second matrix . or you cant multiply them. Think of it like the inner dimensions have to match . and the resulting dimensions of the new matrix are the outer dimensions . Heres an example of matrices with dimensions that would work: Notice how the middle or 8220inner8221 dimensions of the first matrices have to be the same (in this case, 2), and the new matrix has the outside or 8220outer8221 dimensions of the first two matrices (3 by 5). Now, lets do a real-life example to see how the multiplication works . Lets say we want to find the final grades for 3 girls, and we know what their averages are for tests, projects, homework, and quizzes. We also know that tests are 40 of the grade, projects 15, homework 25, and quizzes 20. Heres the data we have: Lets organize the following data into two matrices, and perform matrix multiplication to find the final grades for Alexandra, Megan, and Brittney. To do this, you have to multiply in the following way: Just remember when you put matrices together with matrix multiplication , the columns (what you see across) on the first matrix have to correspond to the rows down on the second matrix . You should end up with entries that correspond with the entries of each row in the first matrix. For example, with the problem above, the columns of the first matrix each had something to do with Tests, Projects, Homework, and Quizzes (grades). The row down on the second matrix each had something to do with the same four items (weights of grades). But then we ended up with information on the three girls (rows down on the first matrix). So Alexandra has a 90, Megan has a 77, and Brittney has an 87 . See how cool this is Matrices are really useful for a lot of applications in real life Now lets do another example let8217s multiply the following matrices: Dont worry probably most of the time youll be doing matrix multiplication will be in the calculator Oh, one more thing Remember that multiplying matrices is not commutative (order makes a difference), but is associative (you can change grouping of matrices when you multiply them). Multiplying matrices is also distributive (you can push through a matrix through parentheses), as long as the matrices have the correct dimensions to be multiplied. Matrices in the Graphing Calculator The TI graphing calculator is great for matrix operations Here are some basic steps for storing, multiplying, adding, and subtracting matrices: (Note that you can also enter matrices using ALPHA ZOOM and the arrow keys in the newer graphing calculators.) Well learn other ways to use the calculator with matrices a little later. Determinants, the Matrix Inverse, and the Identity Matrix Soon we will be solving Systems of Equations using matrices, but we need to learn a few mechanics first Most square matrices (same dimension down and across) have what we call a determinant . which well need to get the multiplicative inverse of that matrix. The inverse of a matrix is what we multiply that square matrix by to get the identity matrix. Well use the inverses of matrices to solve Systems of Equations the inverses will allow us to get variables by themselves on one side (like regular algebra). Youll solve these mainly by using your calculator . but youll also have to learn how to get them by hand. Note that the determinant of a matrix can be designated by (det left text right) or (left text right), and the inverse of a matrix by ( ). Lets do some examples and first get the determinant of matrices (which we can get easily on a calculator). The determinant is always just a scalar (number), and you8217ll see it with two lines around the matrix: Now lets use the determinant to get the inverse of a matrix . Well only work with 2 by 2 matrices, since youll probably be able to use the calculator for larger matrices. Note again that only square matrices have inverses . but there are square matrices that dont have one (when the determinant is 0): When you multiply a square matrix with an identity matrix, you just get that matrix back: . Think of an identity matrix like 1 in regular multiplication (the multiplicative identity), and the inverse matrix like a reciprocal (the multiplicative inverse). Solving Systems with Matrices Why are we doing all this crazy math Because we can solve systems with the inverse of a matrix . since the inverse is sort of like dividing to get the variables all by themselves on one side. To solve systems with matrices, we use . Here is why, if youre interested in the theory (the column on the right provides an example with regular multiplication). ( I is the identity matrix.) Lets take the system of equations that we worked with earlier and show that it can be solved using matrices: Oh, and theres another way to solve these in your calculator, but your teacher may not tell you. Im not going to go into the details, but its using a method called reduced row echelon form . where we can put everything in one matrix (called an augmented matrix ). Lets try this for the following matrix: A little easier, right Solving Word Problems With Matrices Now that we know how to solve systems using matrices, we can solve them so much faster Lets do a couple of pure matrices problems, and then more systems problems :). Matrix Multiplication Problem (a) When we multiply a matrix by a scalar (number), we just multiply all elements in the matrix by that number. So 2P Matrix Equation Problem: This ones a little trickier, since it doesnt really look like a systems problem, but you solve it the same way: Solve the matrix equation for X ( X will be a matrix): Lets add the second matrix to both sides, to get X and its coefficient matrix alone by themselves. Then well divide by the matrix in front of X . Watch the order when we multiply by the inverse (matrix multiplication is not commutative), and thank goodness for the calculator Matrix Multiplication Word Problem: The following matrix consists of a shoe stores inventory of flip flops, clogs, and Mary Janes in sizes small, medium, and large: The store wants to know how much their inventory is worth for all the shoes. How should we set up the matrix multiplication to determine this the best way The trick for these types of problems is to line up what matches (flip flops, clogs, and Mary Janes), and that will be in the middle when we multiply. This way our dimension will line up. Another way to look at it is we need to line up what goes across the first matrix with what goes down the second matrix, and well end up with what goes down the first matrix for these types of problems. So our matrix multiplication will look like this, even though our tables look a little different (I did this on a calculator): So well have 1050 worth of small shoes, 2315 worth of medium shoes, and 1255 worth of large shoes for a total of 4620 . Another Matrix Multiplication Word Problem: A nut distributor wants to know the nutritional content of various mixtures of almonds, cashews, and pecans. Her supplier has provided the following nutrition information: Her first mixture, a protein blend, consists of 6 cups of almonds, 3 cups of cashews, and 1 cup of pecans. Her second mixture, a low fat mix, consists of 3 cups of almonds, 6 cups of cashews, and 1 cup of pecans. Her third mixture, a low carb mix consists of 3 cups of almonds, 1 cup of cashews, and 6 cups of pecans. Determine the amount of protein, carbs, and fats in a 1 cup serving of each of the mixtures. Sometimes we can just put the information we have into matrices to sort of see what we are going to do from there. It makes sense to put the first group of data into a matrix with Almonds, Cashews, and Pecans as columns, and then put the second group of data into a matrix with information about Almonds, Cashews, and Pecans as rows. This way the columns of the first matrix lines up with the rows of the second matrix, and we can perform matrix multiplication. This way we get rid of the number of cups of Almonds, Cashews, and Pecans . which we dont need. So here is the information we have in tablematrix form: Then we can multiply the matrices (we can use a graphing calculator) since we want to end up with the amount of Protein, Carbs, and Fat in each of the mixtures . The product of the matrices consists of rows of Protein, Carbs, and Fat . and columns of the Protein, Low Fat, and Low Carb mixtures : But we have to be careful, since these amounts are for 10 cups (add down to see well get 10 cups for each mixture in the second matrix above). Also, notice how the cups unit canceled out when we did the matrix multiplication (gramscup time cups grams). So to get the answers, we have to divide each answer by 10 to get grams per cup . So the numbers in bold are our answers: Matrix Word Problem when Tables are not Given: Sometimes you8217ll get a matrix word problem where just numbers are given these are pretty tricky. Here is one: An outbreak of Chicken Pox hit the local public schools. Approximately 15 of the male and female juniors and 25 of the male and female seniors are currently healthy, 35 of the male and female juniors and 30 of the male and female seniors are currently sick, and 50 of the male and female juniors and 45 of the male and female seniors are carriers of Chicken Pox. There are 100 male juniors, 80 male seniors, 120 female juniors, and 100 female seniors. Using two matrices and one matrix equation, find out how many males and how many females (dont need to divide by class) are healthy, sick, and carriers. The best way to approach these types of problems is to set up a few manual calculations and see what were doing. For example, to find out how many healthy males we would have, wed set up the following equation and do the calculation. 15(100) .25(80) 35. Likewise, to find out how many females are carriers . we can calculate. 50(120) .45(100) 105. We can tell that this looks like matrix multiplication . And since we want to end up with a matrix that has males and females by healthy, sick and carriers, we know it will be either a 2 x 3 or a 3 x 2. But since we know that we have both juniors and seniors with males and females, the first matrix will probably be a 2 x 2. That means, in order to do matrix multiplication, the second matrix that holds the s of students will have to be a 2 x 3, since there are 3 types of students, healthy (H), sick (S), and carriers (C). Notice how the percentages in the rows in the second matrix add up to 100. Also notice that if we add up the number of students in the first matrix and the last matrix, we come up with 400. So we can come up with the following matrix multiplication: So there will be 35 healthy males, 59 sick males, and 86 carrier males, 43 healthy females, 72 sick females, and 95 carrier females. Pretty clever Matrix Multiplication when Diagonals are Answers: The first table below show the points awarded by judges at a state fair for a crafts contest for Brielle, Brynn, and Briana. The second table shows the multiplier used for the degree of difficulty for each of the pieces the girls created. Find the total score for each of the girls in this contest. This ones a little trickier since it looks like we have two 3 x 2 matrices (tables), but we only want to end up with three answers . the total score for each of the girls. If we were to do the matrix multiplication using the two tables above, we would get: Hmm. this is interesting we end up with a matrix with the girlss names as both rows and columns. It turns out that we have extraneous information in this matrix we only need the information where the girls names line up. So we only look at the diagonal of the matrix to get our answers: Brielle had 86.8 points . Brynn 79.2 points . and Briana 110 points . What we really should have done with this problem is to use matrix multiplication separately for each girl for example, for Brielle, we should have multiplied and so on. Oh well, no harm done and now youll know what to do if you see these types of matrices problems. Using Matrices to Solve Systems Solve these word problems with a system of equations. Write the system, the matrix equations, and solve: Finding the Numbers Word Problem: The sum of three numbers is 26. The third number is twice the second, and is also 1 less than 3 times the first. What are the three numbers Lets translate word-for-word from English to Math that we learned in the Algebra Word Problem Section here . Note that, in the last equation, one less than means put the 1 at the end (do this with real numbers to see why). So we need to move things around so that all the variables (with coefficients in front of them) are on the left, and the numbers are on the right . (It doesn8217t matter which side just watch for negatives). If we just have the variable in the equation, we put a 1 in the matrix if we dont have a variable or a constant (number), we put a 0 in the matrix. So we get: and in matrix form: Putting the matrices in the calculator, and using the methods from above, we get: So the numbers are 5 . Fig. 7 and 14 . Much easier than figuring it out by hand A Florist Must Make 5 Identical Bridesmaid Bouquets Systems Problem Heres a problem from the Systems of Linear Equations and Word Problems Section we can see how much easier it is to solve with a matrix. A florist is making 5 identical bridesmaid bouquets for a wedding. She has 610 to spend (including tax) and wants 24 flowers for each bouquet. Roses cost 6 each, tulips cost 4 each, and lilies cost 3 each. She wants to have twice as many roses as the other 2 flowers combined in each bouquet. How many roses, tulips, and lilies are in each bouquet Lets look at the question that is being asked and define our variables: Let r the number of roses, t the number of tulips, and l the number of lilies. So lets put the money terms together, and also the counting terms together: Now lets put the system in matrices (lets just use one matrix) and on the calculator: So for all the bouquets, well have 80 roses, 10 tulips, and 30 lilies. An Input Output Problem Input-output problems are seen in Economics . where we might have industries that produce for consumers, but also consume for themselves. An application of matrices is used in this input-output analysis, which was first proposed by Wassily Leontief in fact he won the Nobel Prize in economics in 1973 for this work. We can express the amounts (proportions) the industries consume in matrices, such as in the following problem: The following coefficient matrix, or input-output matrix, shows the values of energy and manufacturing consumed internally needed to produce 1 of energy and manufacturing, respectively. In other words, of the value of energy produced ( x for energy, y for manufacturing), 40 percent of it, or .40 x pays to produce internal energy, and 25 percent of it, or .25 x pays for internal manufacturing. Of the value of the manufacturing produced. 25 y pays for its internal energy and .10 y pays for manufacturing consumed internally. The inputs are the amount used in production, and the outputs are the amounts produced. (a) If the capacity of energy production is 15 million and the capacity of manufacturing production is 20 million, how much of each is consumed internally for capacity production (b) How much energy and manufacturing must be produced to have 8 million worth of energy and 5 million worth of manufacturing available for consumer use (a) If production capacities are 15 million for energy and 20 million for manufacturing, the amount consumed internally is . So 11 million of energy is consumed internally and 5.75 million of manufacturing is consumed internally. This makes sense, for example, since were multiplying the proportion of energy consumed internally (.4) by the production capacity for energy (15 million) and adding that to the proportion of energy needed for internal manufacturing (.25) by the production capacity of manufacturing (20 million) to get the total dollar amount of energy needed or consumed internally (11 million). Then we do the same for manufacturing. (b) The amount of energy and manufacturing to be produced to have 8 million worth of energy and 5 million worth of manufacturing available for consumer (non-internal) use is solved using the following equation (we want what8217s 8220left over8221 after the internal consumption, so it makes sense): . To get , we can use the formula . So the two industries must produce 17.7 million worth of energy and 10.5 million worth of manufacturing, respectively. Cramer8217s Rule Sometimes youll have to learn Cramers Rule . which is another way to solve systems with matrices. Cramers Rule was named after the Swiss mathematician Gabriel Cramer, who also did a lot of other neat stuff with math. Cramers rule is all about getting determinants of the square matrices that are used to solve systems. Its really not too difficult it can just be a lot of work, so again, Ill take the liberty of using the calculator to do most of the work Number of Solutions when Solving Systems with Matrices Most systems problems that youll deal with will just have one solution. (These equations are called independent or consistent). But, like we learned in the Systems of Linear Equations and Word Problems Section here . sometimes we have systems where we either have no solutions or an infinite number of solutions. Without going too much into Geometry, lets look at what it looks like when three systems (each system looks like a plane or a piece of paper) have an infinite number of solutions . no solutions . and one solution . respectively: Systems that have an infinite number of solution s (called dependen t or coincident ) will have two equations that are basically the same. One row of the coefficient matrix (and the corresponding constant matrix) is a multiple of another row. Then its like youre trying to solve a system with only two equations, but three unknowns. Systems with no solutions (called inconsistent ) will have one row of the coefficient matrix a multiple of another, but the coefficient matrix will not have this. So a system that has no solutions may look like this: When you try to these types of systems in your calculator (using matrices), youll get an error since the determinant of the coefficient matrix will be 0. This is called a singular matrix and the calculator will tell you so: For the system with no solutions . youll get this, where you can see that you still dont have an identity matrix, and 0 can never equal 1 from the last row: Learn these rules, and practice, practice, practice Use the MathType keyboard to enter a Limit problem, and then click on Submit (the arrow to the right of the problem) to solve the problem. You can also click on the 3 dots in the upper right hand corner to drill down for example problems. If you click on 8220Tap to view steps, you will go to the Mathway site, where you can register for the full version (steps included) of the software. You can even get math worksheets. You can also go to the Mathway site here. where you can register, or just use the software for free without the detailed solutions. There is even a Mathway App for your mobile device. Enjoy 183 thoughts on ldquo The Matrix and Solving Systems with Matrices rdquo This is great, and also can you show when matrices are used in repetition, like occurrence over a few days I love this website, I will have to bookmark it (--) Thanks so much for writing. Good point 8211 I just added this in the Matrix Multiplication section: Remember that multiplying matrices is not commutative (order makes a difference), but is associative (you can change grouping of matrices when you multiply them). Multiplying matrices is also distributive (you can push through a matrix through parentheses), as long as the matrices have the correct dimension to be multiplied. So if you have matrices in repetition, you can multiply the first 2, then the 3rd, or the second 2 first. You cannot change the order of multiplying though. Does this make sense Lisa Can u help me solve this problem Mr. Tan want to support his wife on her dietary plan. He decided to investigate the carbohydrate content of the vegetable they plant. Zusammen. i cup of raw cabbage, 5 raw cauliflowers, and 1 cup of raw tomatoes contain 12 gram of carbohydrates. One cup of raw cabbage and 6 cauliflowers have one-half the carbohydrates of 1 cup of raw tomatoes. One cup each of raw cabbage and raw tomatoes has 3 times the carbohydrate content of 6 raw cauliflowers. Find the number of grams of carbohydrates in the given portion size of each vegetable Thanks for the problem I set it up with the following equations: r 6c t 12 (I think for it to work, you meant 6 raw cauliflowers in the 3rd sentence) r 6c .5t r t 3(6)c Then I put the following matrix in my calculator and used RREF: 1 6 1 12 1 6 -.5 0 to get 1 cup of raw cabbage, 12 of a cauliflower, and 8 cups of tomatoes. 1 -18 1 0 Does this make sense Lisa thank you so much for helping me out..i8217ve really lost it try to do this problem..thank you again. ). hehe B2by2 matriz a1 b1 c2 d1 The question asks me to find A in the equation B(IA-1)I A-1 is the inverse of A and the I is the identity matrix. Can you help me out Thanks for writing I just 8220divided8221 by B (using inverse matrix) and then subtracted the identity matrix and got A-1 -2 1 2 -2. Then took the inverse of that and got A -1, -12, -1, -1. (a b d). Does that make sense Lisa A chemical manufacturer wants to lease a fleet of 24 railroad tank cars with a combined carrying capacity of 420.000 gallons. Tank cars with three different carrying capacities are available. 7.000 gallons, 14.000 gallons, and 28.000 gallons. How many each type of tank car should be leased. use gaussian elimination method to solve it. please any help me out to solve me this problem I am having issues with inputouput matrix8230.Can you please help Electricity consumed internally Steel consumed internally Matrix A .25 .20 .50 .20 If the production capacity of electricity is 15 million and the production capacity for steel is 20 million how much of each is consumed internally for capacity production How much electricity and steel must be produced to have 5 million worth of electricity and 8 million worth of steel available for consumer use. Hi and thanks for writing I had to look up how to do this, but here8217s what I got: You may have also found it in the Finite Mathematics book, by Howard Rolf. Hope that helps Lisa Please help me to set up a linear system in matrix form A feeding station in a field study provides for three types of deer: young deer, adult females and adult males. There are 12 deer in all. In total, the deer consume 18.5 units of food and 14.5 units water each day. Suppose each young deer consumes 1 unit of food and 0.5 unit of water each day. The corresponding values for an adult female are 1.5 and 1, and for an adult male are 2 and 2. The ecologist needs to figure out how many young deer, adult females and adult males are in the herd. Good problem Let y young deer, f adult females, and m adult males. Then you have: Total Deer: y f m 12 Food: 1y 1.5f 2m 18.5 Water:.5y 1f 2m 14.5 Put in Matrix form and solve to get 3 young deer, 5 female deer, and 4 male deer. Could you use the inverse of the matrix to find that answer I do not know whats the purpose of using the inverse Thank you Great Question If you have the same number of variables as equations, you can get the answer to the system of equations by taking the inverse of the coefficient matrix A (the matrix with the numbers before the x, y, and z, for example) and multiplying by the constant matrix B (the matrix with the numbers on the right hand side of the equal signs). So the answer would be A-1 B, where A-1 is the inverse of A. I8217m not sure we can do that with the candy problem below since we have more variables than equations. You can look here to see how I explain it (and up a little further to see about inverses). Can we get the Rank of the matrix in the cal c Not that I know of 8211 sorry I can8217t help you here. Lisa matrices used to give me worst nightmares, it was like a ghost always giving me hard times. The day I discovered this website wow, I felt the heavy burden on my mindset disappearing, recently, I8217m in Love with matrices and I8217m good. Thanks for writing 8211 I LOVE matrices 8211 once I got them That comment made my day. Lisa one more question ask u frd 823082308230823082308230823082308230i have one question Q1. let i m taking three vehicle like car, jeep. motorcycle they are all move to 10 km. how much they will take time at each different path. i m mention below i takes three different s path like 82308230. rough. smooth. zing-zag name of vehicle smooth rough Zing-zag motorcycle 5 mint 10mt 7mt Car 6mt 7mt 9mt jeep 7mt 7mt 8mt Smooth 20 rough 50 Zing - Zag 30 which vehicle best ride for 10km 82308230.i just think and type. if u want any thing change pzl do give me ans 82308230823082308230if u have more example like cricket player. cloth. pen, room pict, home fan. etc any thing we see in normal. can we apply matrix. if we apply give me few example 823082308230823082308230.my email is krrishvishistyahoo. co. in i m waiting ur reply i hop u will back me reply soon 823082308230.. Thanks for writing. I8217m not sure I totally understand the problem, but I used matrices to multiply the type of vehicle by time on each type of road matrix (32153) by a matrix of the weights of each type of road (32151) and got a 32151 matrix of the times for each type of vehicle that is 8.1 7.4 7.3. So the jeep would have the shortest time Does this make sense thax lot for reply 82308230. 82308230823082308230. Pls can you help me solve this problem, The sum of 1200usd is invested in three projects x, y,z at the ratio of 4:5:6 respectively, the expected cash inflow per annum is 700usd, the combined income for projects x and y is 140usd more than the income from project z. calculate the amount invested in project z what is the cash inflow for project z what is the combined cash inflow for projects x and y calculate the amount invested in project y Pls don8217t write the solution in the calculator form because i don8217t have it, thanks. Thanks for writing I will try. Since the income is at a ratio of 4:5:6, we have 4x 5x 6x 1200. Solve for x and get 80. So the income for x is 421580 320, the income for y is 521580400, and the income for z is 621580480. It looks like the cash inflow for the properties are all in the same ratio (7001200), so we have the cash inflow for z (7001200)x480 280. Since the combined cash inflow for x and y is 140 more than z, their combined inflow is 420. I think that answers all the questions. Lisa thanks for quick response, help me with these also 1)A salesman has below record for products sold during peak season of october to december. The products are in three variants A B C. How many units of product C only is he expected to sell to earn 900 commission 2)The buying price of a basket of oranges is 1000 and selling price is 5 per orange. What is the profit per basket if 300 oranges are found in the basket What is the break even point(quantity),if the buying price of a basket remains 1000 and the selling price is 5 What is the profit per basket if 250 oranges are found in the basket For number 1), there is not enough information 8211 are you missing a table For 2), we have Profit Revenues 8211 Cost, so P 5(300) 8211 1000 500. For the break even quantity, 0 5x 8211 1000 x 200. For the profit if there are 250 oranges, 5(250) 8211 1000 250. Hope that makes sense. Lisa Hello Lisa, do you think you could help me with this question without a calculator A dietitian wishes to plan a meal around three foods. The meal is to include 12120 units of vitamin B, 26440 units of vitamin C, and 17260 units of Vitamin E. The number of units of the vitamins in each unit of the foods is summarised: Food I Food II Food III Vitamin B 120 300 420 Vitamin C 240 700 940 Vitamin E 160 450 610 Determine the amount of each food the dietitian should include in the meal in order to exactly meet the vitamin requirements. I tried using your section on solving systems with matrices. However, some of the values are very big and of negative values. I8217d really appreciate it if you could help me Thank you Thanks for writing I8217m getting a negative number too you may want to check with the teacher or book to make sure the numbers are correct. Here8217s a link to how it could be solved, but with different numbers: proton. ucting. udg. mxTIcalctutspc5AMCh5Chapter5StudentQuestions53studentquestions53.html If you get better numbers, let me know Thanks, Lisa Hi Lisa, Question about solving for an unknown matrix8230 When multiplying both sides of an equation by the matrix inverse, like in your problem 8220Find Q when PQ solution8221 If 8216solution8217 had also been a (22152) matrix, what would be the order of the factors Q inverse P22152 solution or Q 22152 solutioninverse P I cannot use a graphing calculator for my tests, so I really appreciate seeing all of the methods on your fabulous site Thanks Thanks for writing and thanks so much for using She Loves Math The first way you described it is correct: Q inverse P22152 solution. Try that and see if you get the correct answers (You can check by multiplying the matrices back). Hope that helps, Lisa Hi When I solve this, I get x 2 and y 1 (I used substitution). Let me know if you want any more of the work. Lisa Great Work Lisa8230..I am a Software Guy but didn8217t had the basic understanding of the Matrices, your explanation was from the basics and of great help. Now I can solve the matrices coding problems quite easily. BWT, which books would you recommend for kids between 10-15 years(for nephews)8230when i was small all books started off with 8220matrix(or any other concept) is used in large applications and should be studied seriously82218230..but never-ever did any book explain how to use it in daily basis.(the drawback of having too much knowledge by writers8230i suppose). Once again i would congratulate you for the great work. Thanks so much for taking a look at the site and writing Honestly, if you8217re just teaching the kids math topics, I always like the 82208230 for Dummies8221 books or the 8220Idiot8217s Guide to 82308221 books. They explain things really in a more direct way, and give lots of examples. Keep using my site, and please let me know if you see any ways it can be better Lisa I would like to really thank you so much for this, it really helped me revise for my maths test that is coming up this week. Keep doing this it is truly amazig () A salesman has below record for products sold during peak seson of October to December. The products are in three variants A, B amp C. How many units of product C only is he expected to sell to earn 900 commissionMonths Sales of Units A B C Total Commission drawn (N) January 90 100 20 800 200 February 130 50 40 900 300 March 60 100 30 850 400 A salesman has below record for products sold during peak seson of October to December. The products are in three variants A, B amp C. How many units of product C only is he expected to sell to earn 900 commissionMonths Sales of Units A January 90 100 20,commission800 200 BFebruary130 50 40,commission 900 300 CMarch 60 100 30,commission 850 400 Thanks for writing, but I8217m not sure I understand this problem. Are the commission numbers for October to December It looks like they are from January to March Lisa Please, I need help with solving the following problems: Problem 1: (Performance Test) A teacher estimates that of the students who pass a test 80 will pass the next test, while of the students who fail a test, 50 will pass the next test. Let x an y denote the number of students who pass and fail a given test, and let u and v be the corresponding numbers for the following test. (a) write a matrix equation relating x amp y to u amp v. (b) suppose that 25 of the teacher8217s students pass the third test and 8 fail the third test. How many students will pass the fourth test. Approximately how many passed the second test an out of shape athlete runs 6 miles per hour, swims 1 mile per hour, and bikes 10 miles per hour. He entered a triathlon, which requires all 3 events and finished it in 5 hours and 40 minutes. A friend, who runs 8 miles per hour, swims 2 miles per hour, and bikes 15 miles per hour finished the course in 3 hours and 35 minutes. The total course was 32 miles. How many miles was each segment (running, swimming and biking) New parents Jim and Lucy want to start saving for their son8221s college education. They have 5000 to invest in three different types of plans. A traditional savings account pays 3 annual interest, a certificate of deposit (CD) pays 6 annual interest, and a prepaid college plan pays 7 annual interest. If they want to invest the same amount in the prepaid college fund as in the other two plans together, how much should they invest in each plan to realize an interest income of 300 for the first year Thanks for writing. For now, I will do problem 3 let me know if you still need help on the other problems. I8217d set up like this. 03x .06y .075z 300. x y z 5000, and z x y. If I put this into a matrix and solve, I get x 1250, y 1250, and z 2500. Does that make sense Lisa Thank you so much for your help, those were the answers I got, but needed to verify. Can you please help witb question 2 which I8217m still having trouble fuguring it out. Thanks an out of shape athlete runs 6 miles per hour, swims 1 mile per hour, and bikes 10 miles per hour. He entered a triathlon, which requires all 3 events and finished it in 5 hours and 40 minutes. A friend, who runs 8 miles per hour, swims 2 miles per hour, and bikes 15 miles per hour finished the course in 3 hours and 35 minutes. The total course was 32 miles. How many miles was each segment (running, swimming and biking) Here8217s how I did this 8211 let t1, t2, t3 be times for first guy, t4, t5, t6 be times for second. t1 t2 t3 5 4060. t4 t5 t6 3 3560. Also, 6t1 t2 10t3 32, and 6t1 8t4, t2 2t5, and 10t3 15t6. Solving by matrices, I get t1 1 23, t2 2, and t3 2. So then I get the distances of 10, 2, and 20 for running, swimming and biking. Does that make sense Lisa Hello there I need some help with this word problem matrix. I8217ve been working on it for hours and have gotten absolutely nowhere A health shop owner made trail mix containing dried fruit, nuts, amp carob chips. The dried fruit sells for 5.50lb, the nuts for 7.50lb, amp 8.50lb for carob chips. The shop owner mixed 50lbs of trail mix amp sells it for 6.70lb. If the amount of nuts is 5lbs more than the carob chips, how much of each item was used in the trail mix Thanks for writing Here8217s how I8217d do this problem: 5.5f 7.5n 8.5c 50(6.7), f n c 50, n 5 c. Then I used the following matrix: 5.5 7.5 8.5 335 1 1 1 50 0 1 -1 5 (This is a 4 by 3 matrix, and I use RREF in the graphing calculator to get the answers). I get 25 lbs of fruit, 15 of nuts, and 10 of carob chips. Does this make sense Lisa OH MY GOSH, thank you so so much I was using the 6.70 for the second equation and 50lbs just for the first instead of multiplying 50 by 6.70. I appreciate it so much This website is amazing thank you for using so many examples for even upper level math courses. My Trig amp Calculus final are in a few weeks amp this will save my life for sure Aisha has RM10000 to invest. As her financial consultant, you recommend that she invest in Treasury bills that yield 6. Treasury bonds that yield 7 and corporate bonds that yield 8. Aisha wants to have an annual income of RM680, and the amount invested in corporate bond must be half that invested in Treasury bills. Find the amount of each investment. miss what the way to make this in matrixi not able to answer it and if you know to make it in c coding can u share it. Here8217s how I8217d do this: x y z 10000. 06x .07y .08z 680. z .5x. The matrix would look like 1 1 1 10000 .06 .07 .08 680 -.5 0 1 0 I get 4000 in treasury bills, 4000 in treasury bonds, and 2000 in corporate bonds. Does that make sense Lisa Hey Lisa, I really need your help A roadside fruit stand sells mangoes at Php 75 a kilo, pomelos at Php 90 a kilo, and star apples at Php 60 a kilo. Karla buys 18 kilos of fruits at a total cost of Php 1380. Her pomelos and star apple together cost Php 180 more than her mangoes. How many kilos of each kind of fruit did she buy Write a system of equations using Cramer8217s Rule. Here8217s how I8217d set up this problem: 75m 90p 60a 1380. m p a 18. 90p 60a 75m 180. We can then set up in a matrix: 75 90 60 1380 1 1 1 18 -75 90 60 180 I then get 8 mangos, 6 pomelos, and 4 star apples. You can do this with Cramer8217s Rule using the information found here. Does that make sense Lisa How much copper and how much iron should be added to 100 lb of an alloy containing 25 copper and 40 iron in order to obtain an alloy containing 30 copper and 50 iron Write a system of equations using Cramer8217s Rule. Thanks for writing I found this problem here and you can solve it using Cramer8217s Rule the way I explained here. Does that help Lisa Jane is asked to buy three sizes of bottled water: A, B and C. The total number of bottles she needs to buy is 50. She has a budget of Php 1500. Size A is Php 20 each, size B is Php 50 each, and size C is Php 30 each. Additionally, the number of bottles of size A should be equal to that size of C. How many of each size should she buy Write a system of equations using Cramer8217s Rule. Here is how I8217d set this up: a b c 50, 20a 50b 30c 1500, a c. Then you can put this in a matrix and solve using Cramer8217s Rule . Thanks, Lisa plz solve this question. show by considering minors that the matrice A inverse. A transpose inverse. have the same rank as A 8230. it will be easy for me if u attach image of the work out Thanks for writing Unfortunately, these questions are beyond the scope of this website. You might look at this site mathsisfunalgebramatrix-inverse-minors-cofactors-adjugate. html. and see if that helps So sorry 8211 I will try to do more research to see what I can figure out thought Lisa any way thanku lisa for ur help 8230 1.The buying price of a basket of oranges is 1000 and the selling price is 5 per orange. what is the profit per basket if 300 oranges are found in the basket. ein. 150 b.200 c.300 d. 500. 2. what is the break even point(quantity)if the buying price of a basket remains 1000 and the selling price is 5 Thanks for writing Here8217s how I8217d do this problem: Let x the number of oranges. Then we have Profit Revenue 8211 Cost. So Profit 5x 8211 1000. If 300 oranges are in the basket, we have Profit 5(300) 8211 1000 500 (d). The break even point would be when profit 0, so 0 5x 8211 1000, or x 200 oranges. Does that make sense Lisa Hello, I see that you have been very helpful with assisting with systems of equations and matrices. Could you please help me set this up You have been hired by a consultant for Crazy Al8217s Car Rentals in the city of Metropolis. Crazy Al8217s car rentals has a total of 2200 cars that it rents from three locations within the city: Metropolis Airport, downtown and Suburban Airport. Following is the weekly rental and return patterns: 90 of costumers who rent from Metropolis Airport return their cars to Metropolis Airport 5 rent from Metropolis Airport and return to Downtown 80 rent from Downtown and return to downtown 10 rent from Downtown and return to Metropolis Airport 10 rent from Suburban Airport and return to Metropolis Airport 5 rent from Suburban Airport and return to downtown How many of his cars should be at each of his three locations at the start of each week so that the same number of cars will be there at the end of the week (and hence at the start of the next week). Use systems of equations and matrices to set up a systems of equations representing this situation and solve this problem. Include math steps. Jede Hilfe wäre willkommen. I don8217t know where to even start Thanks Thanks for writing. I found this: answers. yahooquestionindexqid20140216223142AAddVGd and then it shouldn8217t be too difficult solving the system with matrices. Let me know if you want it solved. Thanks, Lisa 1) The 7th term of an A. P is 15 and the fourth term is 9. Find the common difference of the sequence 2) The 7th term of an A. P is 15 and the fourth term is 9. find the sequence fifth term. 3) The 7th term of an A. P is 15 and the fourth term is 9. Find the sequence tenth term. 4) The 7th term of an A. P is 15 and the fourth term is 9. Find the sequence first term 5) Find the 7th term of an A. P whose first term is 102 and common difference is -3, I await your respose liza. Thanks So let8217s use the equation for an arithmetic sequence: an a1 d(n 8211 1). Since 15 8211 9 is 6, and 7 8211 4 is 3, we can see that the common difference is 63 2. (See how this would mean every term goes up by 2) So we have an a1 2(n 8211 1). Let8217s plug in a 8220point8221 to get what a1 is: 15 a1 2(7 8211 1), so a1 3. So the sequence is an 3 2(n 8211 1). So the 5th term or a5 is 3 2(5 8211 1), or 11. See if you can do the other problems Thanks Lisa i need help.. question is. An automobile company uses three types of steel S1, S2 and S3.For producing three types of cars c1, c2. c3. Steel Requirements (in tons) for each type of car are given below: type of cars C1 C2 C3 S1 2 3 4 S2 1 1 2 TYPE OF STEEL S3 3 2 1 Determine the number of cars of each type which can be produced using 29, 13 and 16 tons of steel of three types respectively. Thanks for writing I put this in a matrix and got C12, C23 and C34. Here is the matrix I solved: 2 3 4 29 1 1 2 13 3 2 1 16 Does that make sense Lisa An automobile company uses three types of steel S1, S2 and S3.For producing three types of cars c1, c2. c3. Steel Requirements (in tons) for each type of car are given below: Type of car C1 C2 C3 S1 2 3 4 S2 1 1 2 S3 3 2 1 Q1. Determine the number of cars of each type which can be produced using 29, 13 and 16 tons of steel of three types respectively

No comments:

Post a Comment