-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomeworktryandfail.nb
109 lines (101 loc) · 3.31 KB
/
homeworktryandfail.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 10.2' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 3187, 99]
NotebookOptionsPosition[ 2914, 85]
NotebookOutlinePosition[ 3253, 100]
CellTagsIndexPosition[ 3210, 97]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
RowBox[{
RowBox[{"Simps", "[",
RowBox[{"f_", ",", "a_", ",", "b_", ",", "er_"}], "]"}], " ", ":=", " ",
RowBox[{"Module", "[",
RowBox[{"{",
RowBox[{"s1", ",", " ", "s2"}], "}"}]}]}]], "Input",
CellChangeTimes->{{3.684896654445506*^9, 3.6848967458911715`*^9}}],
Cell[BoxData[
RowBox[{"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"Simpsfast", "[",
RowBox[{"f_", ",", " ", "a_", ",", " ", "b_", ",", " ", "er_"}], "]"}],
" ", ":=", " ",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{
"fa", ",", " ", "fb", ",", " ", "fah", ",", " ", "fbh", ",", " ",
RowBox[{"h", " ", "=", " ",
RowBox[{
RowBox[{"(",
RowBox[{"b", "-", "a"}], ")"}], "/", "2"}]}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"fa", " ", "=", " ",
RowBox[{"f", "[", "a", "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"fb", " ", "=", " ",
RowBox[{"f", "[", "b", "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"fah", " ", "=", " ",
RowBox[{"f", "[",
RowBox[{"a", "+", "h"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"fbh", " ", "=", " ",
RowBox[{"f", "[",
RowBox[{"b", "+", "h"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"Simpsfastcalc", "[",
RowBox[{
"fa", ",", " ", "fb", ",", " ", "fah", ",", " ", "fbh", ",", " ",
"er"}], "]"}], ";"}]}], "]"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Simpsfastcalc", "[",
RowBox[{
"a_", ",", " ", "b_", ",", " ", "fa_", ",", " ", "fb_", ",", " ",
"er_"}], "]"}], " ", ":=", " ",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"s1", ",", " ", "s2", ",", " ",
RowBox[{"h", " ", "=", " ",
RowBox[{
RowBox[{"(",
RowBox[{"b", "-", "a"}], ")"}], "/", "2"}]}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"s1", " ", "=", " ",
RowBox[{"h",
RowBox[{"(",
RowBox[{"fa", " ", "+", " ",
RowBox[{"4", "*",
RowBox[{"f", "[",
RowBox[{"a", "+", "h"}], "]"}]}], "+",
"fb"}]}]}]}]}]}]}]}]}]], "Input",
CellChangeTimes->{{3.6848969140336857`*^9, 3.684896914291753*^9}}]
},
WindowSize->{958, 988},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
FrontEndVersion->"10.2 for Microsoft Windows (64-bit) (July 7, 2015)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 293, 7, 31, "Input"],
Cell[854, 29, 2056, 54, 212, "Input"]
}
]
*)
(* End of internal cache information *)