- #1
steven187
- 176
- 0
hello all
well I wanted to write a mathematica program so i can be able to experiment but for some reason i can't get it to work, does anybody have any ideas on where I am going wrong, below is something that i have cut out of my mathematica program, all you have to do is cut and paste into mathematica
please help
thank you
\!\(\(LowerRiemann[a0_, b0_,
n0_] := \[IndentingNewLine]Module[{a = a0, b = b0, n = n0,
X}, \[IndentingNewLine]\[IndentingNewLine]X\_i_ =
a + i\ \(b - a\)\/n\ ; \ \[IndentingNewLine]sum =
0; \[IndentingNewLine]For[\[IndentingNewLine]i = 1,
i <= n, \(i++\), \[IndentingNewLine]Xv =
Select[Xvals,
X\_\(i - 1\) <= #1 <= X\_i\ &]; \[IndentingNewLine]Ymin = \
Min[f[Xv]]; \ \[IndentingNewLine]sum =
sum + Ymin\ \(b - a\)\/n;\ \ \[IndentingNewLine]]; \ \
\[IndentingNewLine]Return[\ \ sum\ ];\ ];\)\ \[IndentingNewLine]
\(f[x_] = x\^2;\)\[IndentingNewLine]
\(a = 0;\)\[IndentingNewLine]
b = 1; \[IndentingNewLine]
\(n = 25;\)\[IndentingNewLine]
LowerRiemann[a, b, n]\)
well I wanted to write a mathematica program so i can be able to experiment but for some reason i can't get it to work, does anybody have any ideas on where I am going wrong, below is something that i have cut out of my mathematica program, all you have to do is cut and paste into mathematica
please help
thank you
\!\(\(LowerRiemann[a0_, b0_,
n0_] := \[IndentingNewLine]Module[{a = a0, b = b0, n = n0,
X}, \[IndentingNewLine]\[IndentingNewLine]X\_i_ =
a + i\ \(b - a\)\/n\ ; \ \[IndentingNewLine]sum =
0; \[IndentingNewLine]For[\[IndentingNewLine]i = 1,
i <= n, \(i++\), \[IndentingNewLine]Xv =
Select[Xvals,
X\_\(i - 1\) <= #1 <= X\_i\ &]; \[IndentingNewLine]Ymin = \
Min[f[Xv]]; \ \[IndentingNewLine]sum =
sum + Ymin\ \(b - a\)\/n;\ \ \[IndentingNewLine]]; \ \
\[IndentingNewLine]Return[\ \ sum\ ];\ ];\)\ \[IndentingNewLine]
\(f[x_] = x\^2;\)\[IndentingNewLine]
\(a = 0;\)\[IndentingNewLine]
b = 1; \[IndentingNewLine]
\(n = 25;\)\[IndentingNewLine]
LowerRiemann[a, b, n]\)