{
"DeviceWidth" : 748,
"DefaultUnitSet" : "SI",
"CaseName" : "Taylor Series Expansion",
"Version" : 1.1,
"UserUnits" : [],
"RootModel" : {
"HideInfo" : "n",
"diagramY" : 115,
"name" : "Root",
"diagramX" : 0,
"Notes" : "Tap here first...\n\nSeries expansion is a common mathematical tool for approximating functions that cannot be directly calculated. This example will show how Math Minion's matrix object can be used to easily implement a series expansion, specifically a Taylor series to calculate e^x and sin(x).\n\nSee the notes for each of the objects.",
"Objects" : [
{
"HideInfo" : "n",
"name" : "x",
"Type" : "Expression",
"Notes" : "Just an arbitrary value for the functions to work on.",
"Formula" : {
"Formula" : "2"
},
"DiagramY" : -10,
"DiagramX" : 10
},
{
"HideInfo" : "n",
"CellInputs" : {
"0_0" : "x^{row}/{factorial {row}}"
},
"columnCount" : "1",
"name" : "taylorE",
"Type" : "Matrix",
"Notes" : "An exponential function e^x can be represented by the Taylor series:\n\ne^x = sum from n=0 to infinity of:\n\n x^n / n!\n\nThe terms of this summation, except for n=0, are represented in this matrix as a column calculated by the formula\n\nx^{row}/{factorial {row}}\n\nwhich is assigned to the column header cell of column 1.\n\nThe function {row} will return the number of each row and thus represents n starting from 1 rather than 0. This means we still have to add the n=0 term, which is just 1, when we sum the terms.\n\nThe number of terms is set by setting the number or rows in the matrix.",
"DiagramY" : -95,
"rowCount" : "10",
"DiagramX" : 100
},
{
"HideInfo" : "n",
"CellInputs" : {
"0_0" : "x^(2*{row}+1) * -1^{row}/{factorial 2*{row}+1}"
},
"columnCount" : "1",
"name" : "taylorSine",
"Type" : "Matrix",
"Notes" : "This follows the same procedure as taylorE, but uses the formula:\n\nx^(2*{row}+1) * -1^{row}/{factorial 2*{row}+1}\n\nto calculate the Taylor expansion terms for sin(x), which are:\n\n((-1)^n) * x^(2n+1)\n-------------------------\n (2n+1)!",
"DiagramY" : -10,
"rowCount" : "5",
"DiagramX" : 195
},
{
"HideInfo" : "n",
"name" : "sumSine",
"Type" : "Expression",
"Notes" : "In this case the n=0 term is just x, which is added to the sum of their other terms calculated by taylorSine.",
"Formula" : {
"Formula" : "x+{sum taylorSine}"
},
"DiagramY" : 25,
"DiagramX" : 195
},
{
"HideInfo" : "n",
"name" : "sumE",
"Type" : "Expression",
"Notes" : "Using the sum function with TaylorE as the argument will sum all the terms of the expansion except for the n=0 term.\n\nThe value of this term is just 1, and it is added to the function for a formula:\n\n1+{sum taylorE}\n",
"Formula" : {
"Formula" : "1+{sum taylorE}"
},
"DiagramY" : -65,
"DiagramX" : 100
},
{
"HideInfo" : "n",
"name" : "diffE",
"Type" : "Expression",
"Notes" : "Math Minion has an e to the x function, so we can easily check the accuracy of our approximation with the formula:\n\n{exp x} - sumE\n\nTry altering the number of terms in the expansion to see how that affects the accuracy. This is done by just changing the number of rows in the TaylorE matrix object.",
"Formula" : {
"Formula" : "{exp x} - sumE"
},
"DiagramY" : -35,
"DiagramX" : 100
},
{
"HideInfo" : "n",
"name" : "diffSine",
"Type" : "Expression",
"Notes" : "Calculates the difference between the approximation and the built in sine function.",
"Formula" : {
"Formula" : "{sin x}-sumSine"
},
"DiagramY" : 55,
"DiagramX" : 195
},
{
"HideInfo" : "n",
"CellInputs" : {
"0_1" : "1+{sum taylorE[1:{row}]}",
"0_0" : "0"
},
"columnCount" : "1",
"name" : "rowE",
"Type" : "Matrix",
"Notes" : "In order to plot the convergence as the number of terms increase, the formula for the column in this matrix:\n\n1+{sum taylorE[1:{row}]}\n\nIs similar to the one for sumE, but it uses the range operator : and the index operators [] to sum the first n rows of taylorE.\n\nNote that the number of rows for this matrix is set to the formula:\n\n{nrows taylorE}\n\nso that it is always the same size as taylorE.\n",
"DiagramY" : -95,
"rowCount" : "{nrows taylorE}",
"DiagramX" : 180
},
{
"HideInfo" : "n",
"X1" : {
"vmax" : "",
"Y1" : {
"vmax" : "",
"lineType" : 0,
"v" : "rowE",
"vmin" : ""
},
"v" : "1:{nrows taylorE}",
"vmin" : ""
},
"name" : "Plot",
"Type" : "Graph/Table",
"Notes" : "This plots the sum to n of the taylorE terms, as calculated by rowE, versus n as calculated by the formula:\n\n1:{nrows taylorE}\n\nNote that term 0, which would be 1, is not plotted.\n",
"DiagramY" : -65,
"DiagramX" : 185
}
],
"diagramScale" : 3,
"DiagramY" : -12321,
"DiagramX" : -12321
},
"Program" : "Rtm"
}