(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 24912, 749] NotebookOptionsPosition[ 23769, 705] NotebookOutlinePosition[ 24177, 721] CellTagsIndexPosition[ 24134, 718] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Math 481A California State University, Northridge Cubic Splines\ \>", "Section"], Cell["\[Copyright]2005 BE Shapiro", "Subsection"] }, Open ]], Cell[CellGroupData[{ Cell["spline: calculate cubic spline polynomials ", "Section"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"<<", "LinearAlgebra`Tridiagonal`"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"General", "::", "\<\"obspkg\"\>"}], RowBox[{ ":", " "}], "\<\"\\!\\(\\\"LinearAlgebra`Tridiagonal`\\\"\\) is now \ obsolete. The legacy version being loaded may conflict with current \ Mathematica functionality. See the Compatibility Guide for updating \ information. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:Compatibility/Tutorials/LinearAlgebra/Tridiagonal\\\", \ ButtonNote -> \\\"General::obspkg\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.3986018246100616`*^9}], Cell[BoxData[ RowBox[{ RowBox[{"TridiagonalSolve", "::", "\<\"shdw\"\>"}], RowBox[{ ":", " "}], "\<\"Symbol \\!\\(\\\"TridiagonalSolve\\\"\\) appears in \ multiple contexts \\!\\({\\\"LinearAlgebra`Tridiagonal`\\\", \\\"Global`\\\"}\ \\); definitions in context \\!\\(\\\"LinearAlgebra`Tridiagonal`\\\"\\) may \ shadow or be shadowed by other definitions. \\!\\(\\*ButtonBox[\\\"\ \[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/shdw\\\", ButtonNote -> \ \\\"LinearAlgebra`Tridiagonal`TridiagonalSolve::shdw\\\"]\\)\"\>"}]], \ "Message", "MSG", CellChangeTimes->{3.3986018248940163`*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"spline", "[", RowBox[{"points__", ",", " ", "x_"}], "]"}], ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "n", ",", "xi", ",", "f", ",", "a", ",", "b", ",", "c", ",", "d", ",", "h", ",", "r", ",", " ", "subdiag", ",", "maindiag", ",", "superdiag", ",", " ", "equations", ",", "i", ",", "j", ",", "M", ",", "xmxi"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"!", RowBox[{"ListQ", "[", "points", "]"}]}], ",", " ", RowBox[{ RowBox[{"Print", "[", "\"\\"", "]"}], ";", RowBox[{"Return", "[", "]"}], ";"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"!", RowBox[{"And", "@@", RowBox[{"ListQ", "/@", "points"}]}]}], ",", " ", RowBox[{ RowBox[{ "Print", "[", "\"\\"", "]"}], ";", " ", RowBox[{"Return", "[", "]"}], ";"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Union", "[", RowBox[{"Length", "/@", "points"}], "]"}], "\[NotEqual]", " ", RowBox[{"{", "2", "}"}]}], ",", " ", RowBox[{ RowBox[{"Print", "[", "]"}], ";", RowBox[{ "Return", "[", "\"\\"", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"f", "=", RowBox[{"Last", "/@", "points"}]}], ";", "\[IndentingNewLine]", RowBox[{"a", "=", "f"}], ";", "\[IndentingNewLine]", RowBox[{"n", "=", RowBox[{"Length", "[", "points", "]"}]}], ";", " ", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"h", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"n", "-", "1"}], "}"}]}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "<", " ", "n"}], ",", " ", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"h", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{ RowBox[{"points", "[", RowBox[{"[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "1"}], "]"}], "]"}], "-", RowBox[{"points", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}]}]}], ";"}]}], " ", "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"subdiag", "=", RowBox[{"Append", "[", RowBox[{ RowBox[{"Drop", "[", RowBox[{"h", ",", RowBox[{"-", "1"}]}], "]"}], ",", "0"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"superdiag", "=", RowBox[{"Prepend", "[", RowBox[{ RowBox[{"Drop", "[", RowBox[{"h", ",", RowBox[{"-", "1"}]}], "]"}], ",", " ", "0"}], "]"}]}], ";", " ", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"maindiag", "=", RowBox[{"{", "1", "}"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", RowBox[{"n", "-", "2"}]}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"maindiag", " ", "=", " ", RowBox[{"Append", "[", RowBox[{"maindiag", ",", RowBox[{"2", "*", RowBox[{"(", RowBox[{ RowBox[{"h", "[", RowBox[{"[", "i", "]"}], "]"}], "+", RowBox[{"h", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}]}], ")"}]}]}], "]"}]}], ";"}]}], " ", "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"maindiag", "=", RowBox[{"Append", "[", RowBox[{"maindiag", ",", "1"}], "]"}]}], ";", " ", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"r", "=", RowBox[{"{", "0", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "2"}], ",", " ", RowBox[{"i", "\[LessEqual]", " ", RowBox[{"n", "-", "1"}]}], ",", " ", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"r", "=", RowBox[{"Append", "[", RowBox[{"r", ",", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"3", "/", RowBox[{"h", "[", RowBox[{"[", "i", "]"}], "]"}]}], ")"}], "*", RowBox[{"(", RowBox[{ RowBox[{"a", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "-", RowBox[{"a", "[", RowBox[{"[", "i", "]"}], "]"}]}], ")"}]}], "-", RowBox[{ RowBox[{"(", RowBox[{"3", "/", RowBox[{"h", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], ")"}], RowBox[{"(", RowBox[{ RowBox[{"a", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"a", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], ")"}]}]}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"r", "=", RowBox[{"Append", "[", RowBox[{"r", ",", "0"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"TridiagonalSolve", "[", RowBox[{"subdiag", ",", " ", "maindiag", ",", "superdiag", ",", "r"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"d", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", " ", RowBox[{"j", "<", "n"}], ",", " ", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"d", "=", RowBox[{"Append", "[", RowBox[{"d", ",", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"c", "[", RowBox[{"[", RowBox[{"j", "+", "1"}], "]"}], "]"}], "-", RowBox[{"c", "[", RowBox[{"[", "j", "]"}], "]"}]}], ")"}], "/", RowBox[{"(", RowBox[{"3", "*", RowBox[{"h", "[", RowBox[{"[", "j", "]"}], "]"}]}], ")"}]}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"b", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "<", "n"}], ",", " ", RowBox[{"j", "++"}], ",", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"b", "=", RowBox[{"Append", "[", RowBox[{"b", ",", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"a", "[", RowBox[{"[", RowBox[{"j", "+", "1"}], "]"}], "]"}], "-", RowBox[{"a", "[", RowBox[{"[", "j", "]"}], "]"}]}], ")"}], "/", RowBox[{"h", "[", RowBox[{"[", "j", "]"}], "]"}]}], " ", "-", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"h", "[", RowBox[{"[", "j", "]"}], "]"}], "/", "3"}], ")"}], RowBox[{"(", RowBox[{ RowBox[{"2", " ", RowBox[{"c", "[", RowBox[{"[", "j", "]"}], "]"}]}], " ", "+", " ", RowBox[{"c", "[", RowBox[{"[", RowBox[{"j", "+", "1"}], "]"}], "]"}]}], ")"}]}]}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"a", "=", RowBox[{"Drop", "[", RowBox[{"a", ",", RowBox[{"-", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"Drop", "[", RowBox[{"c", ",", RowBox[{"-", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"xi", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"First", "/@", "points"}], ",", RowBox[{"-", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M", "=", RowBox[{"Transpose", "[", RowBox[{"{", RowBox[{"a", ",", "b", ",", "c", ",", "d"}], "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"equations", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "<", "n"}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"xmxi", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"x", "-", RowBox[{"xi", "[", RowBox[{"[", "i", "]"}], "]"}]}], ")"}], "^", "j"}], ",", " ", RowBox[{"{", RowBox[{"j", ",", "0", ",", RowBox[{"n", "-", "2"}]}], "}"}]}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"equations", "=", RowBox[{"Append", "[", RowBox[{"equations", ",", RowBox[{"xmxi", ".", RowBox[{"M", "[", RowBox[{"[", "i", "]"}], "]"}]}]}], "]"}]}], ";"}]}], " ", "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Return", "[", "equations", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Example", "Section"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"spline", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "75"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "77"}], "}"}], ",", RowBox[{"{", RowBox[{"6", ",", "80"}], "}"}], ",", RowBox[{"{", RowBox[{"9", ",", "74"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"12", ",", "72"}], "}"}]}], "}"}], ",", "x"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"75", "+", FractionBox[ RowBox[{"19", " ", "x"}], "56"], "+", FractionBox[ RowBox[{"55", " ", SuperscriptBox["x", "3"]}], "1512"]}], ",", RowBox[{"77", "+", RowBox[{ FractionBox["37", "28"], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "3"}], "+", "x"}], ")"}]}], "+", RowBox[{ FractionBox["55", "168"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "3"}], "+", "x"}], ")"}], "2"]}], "-", RowBox[{ FractionBox["73", "504"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "3"}], "+", "x"}], ")"}], "3"]}]}], ",", RowBox[{"80", "-", RowBox[{ FractionBox["5", "8"], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "6"}], "+", "x"}], ")"}]}], "-", RowBox[{ FractionBox["41", "42"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "6"}], "+", "x"}], ")"}], "2"]}], "+", RowBox[{ FractionBox["29", "168"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "6"}], "+", "x"}], ")"}], "3"]}]}], ",", RowBox[{"74", "-", RowBox[{ FractionBox["51", "28"], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "9"}], "+", "x"}], ")"}]}], "+", RowBox[{ FractionBox["97", "168"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "9"}], "+", "x"}], ")"}], "2"]}], "-", FractionBox[ RowBox[{"97", " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "9"}], "+", "x"}], ")"}], "3"]}], "1512"]}]}], "}"}]], "Output", CellChangeTimes->{ 3.398601733440155*^9, 3.398601774292286*^9, {3.398601830398733*^9, 3.398601838006586*^9}}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["equalIntervalSplines: assumes points are equally spaced", "Section"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"equalIntervalSplines", "[", RowBox[{"h_", ",", "x0_", ",", " ", "x_", ",", " ", "f__"}], "]"}], ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "n", ",", "a", ",", "A", ",", "i", ",", " ", "w", ",", "c", ",", "b", ",", "M", ",", " ", "equations", ",", "xi"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", RowBox[{"Length", "[", RowBox[{"{", "f", "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"a", "=", RowBox[{"{", "f", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"A", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", "n", "}"}], ",", RowBox[{"{", "n", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "=", "h"}], ";", "\[IndentingNewLine]", RowBox[{"w", "=", RowBox[{"{", "0", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "2"}], ",", RowBox[{"i", "<", "n"}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "i"}], "]"}], "]"}], "=", RowBox[{"4", "*", "h"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", RowBox[{"i", "-", "1"}]}], "]"}], "]"}], "=", "h"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", RowBox[{"i", "+", "1"}]}], "]"}], "]"}], "=", "h"}], ";", "\[IndentingNewLine]", RowBox[{"w", "=", RowBox[{"Append", "[", RowBox[{"w", ",", RowBox[{ RowBox[{"a", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}], "-", RowBox[{"2", RowBox[{"a", "[", RowBox[{"[", "i", "]"}], "]"}]}], "+", RowBox[{"a", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}]}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"n", ",", "n"}], "]"}], "]"}], "=", "1"}], ";", "\[IndentingNewLine]", RowBox[{"w", "=", RowBox[{ RowBox[{"(", RowBox[{"3", "/", "h"}], ")"}], "*", RowBox[{"Append", "[", RowBox[{"w", ",", "0"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{ RowBox[{"Inverse", "[", "A", "]"}], ".", "w"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"b", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"d", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "<", "n"}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"b", "=", RowBox[{"Append", "[", RowBox[{"b", ",", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"a", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "-", RowBox[{"a", "[", RowBox[{"[", "i", "]"}], "]"}]}], ")"}], "/", "h"}], " ", "-", " ", RowBox[{ RowBox[{"(", RowBox[{"h", "/", "3"}], ")"}], "*", RowBox[{"(", RowBox[{ RowBox[{"2", RowBox[{"c", "[", RowBox[{"[", "i", "]"}], "]"}]}], "+", RowBox[{"c", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}]}], ")"}]}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"d", "=", RowBox[{"Append", "[", RowBox[{"d", ",", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"c", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "-", RowBox[{"c", "[", RowBox[{"[", "i", "]"}], "]"}]}], ")"}], "/", RowBox[{"(", RowBox[{"3", " ", "h"}], ")"}]}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"a", "=", RowBox[{"Drop", "[", RowBox[{"a", ",", RowBox[{"-", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"Drop", "[", RowBox[{"c", ",", RowBox[{"-", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M", "=", RowBox[{"Transpose", "[", RowBox[{"{", RowBox[{"a", ",", "b", ",", "c", ",", "d"}], "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"equations", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "<", "n"}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"xi", "=", RowBox[{"x0", "+", RowBox[{ RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}], "*", "h"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"xmxi", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"x", "-", "xi"}], ")"}], "^", "j"}], ",", " ", RowBox[{"{", RowBox[{"j", ",", "0", ",", RowBox[{"n", "-", "2"}]}], "}"}]}], "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"equations", "=", RowBox[{"Append", "[", RowBox[{"equations", ",", RowBox[{"xmxi", ".", RowBox[{"M", "[", RowBox[{"[", "i", "]"}], "]"}]}]}], "]"}]}], ";"}]}], " ", "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "equations", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Example", "Section"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"equalIntervalSplines", "[", RowBox[{ "3", ",", "0", ",", "x", ",", "75", ",", "77", ",", "80", ",", "74", ",", "72"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"75", "+", FractionBox[ RowBox[{"19", " ", "x"}], "56"], "+", FractionBox[ RowBox[{"55", " ", SuperscriptBox["x", "3"]}], "1512"]}], ",", RowBox[{"77", "+", RowBox[{ FractionBox["37", "28"], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "3"}], "+", "x"}], ")"}]}], "+", RowBox[{ FractionBox["55", "168"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "3"}], "+", "x"}], ")"}], "2"]}], "-", RowBox[{ FractionBox["73", "504"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "3"}], "+", "x"}], ")"}], "3"]}]}], ",", RowBox[{"80", "-", RowBox[{ FractionBox["5", "8"], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "6"}], "+", "x"}], ")"}]}], "-", RowBox[{ FractionBox["41", "42"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "6"}], "+", "x"}], ")"}], "2"]}], "+", RowBox[{ FractionBox["29", "168"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "6"}], "+", "x"}], ")"}], "3"]}]}], ",", RowBox[{"74", "-", RowBox[{ FractionBox["51", "28"], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "9"}], "+", "x"}], ")"}]}], "+", RowBox[{ FractionBox["97", "168"], " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "9"}], "+", "x"}], ")"}], "2"]}], "-", FractionBox[ RowBox[{"97", " ", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"-", "9"}], "+", "x"}], ")"}], "3"]}], "1512"]}]}], "}"}]], "Output", CellChangeTimes->{3.398601741646119*^9, 3.398601844738155*^9}] }, Open ]] }, Open ]] }, WindowSize->{690, 840}, WindowMargins->{{361, Automatic}, {140, Automatic}}, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (June 19, 2007)", StyleDefinitions->FrontEnd`FileName[{"Creative"}, "PastelColor.nb", CharacterEncoding -> "UTF-8"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 90, 4, 112, "Section"], Cell[683, 29, 49, 0, 34, "Subsection"] }, Open ]], Cell[CellGroupData[{ Cell[769, 34, 62, 0, 72, "Section"], Cell[CellGroupData[{ Cell[856, 38, 88, 2, 37, "Input"], Cell[947, 42, 595, 11, 59, "Message"], Cell[1545, 55, 661, 12, 59, "Message"] }, Open ]], Cell[2221, 70, 10360, 275, 968, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[12618, 350, 26, 0, 72, "Section"], Cell[CellGroupData[{ Cell[12669, 354, 437, 14, 37, "Input"], Cell[13109, 370, 1846, 66, 132, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[15004, 442, 74, 0, 72, "Section"], Cell[15081, 444, 6608, 178, 548, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[21726, 627, 26, 0, 72, "Section"], Cell[CellGroupData[{ Cell[21777, 631, 168, 4, 37, "Input"], Cell[21948, 637, 1793, 64, 132, "Output"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)