many edits
This commit is contained in:
@@ -369,8 +369,10 @@ Any partition $a =x_0 < x_1 < \cdots < x_n=b$ is related to a partition of $[a-c
|
||||
|
||||
|
||||
\begin{align*}
|
||||
f(c_1 -c) \cdot (x_1 - x_0) &+ f(c_2 -c) \cdot (x_2 - x_1) + \cdots + f(c_n -c) \cdot (x_n - x_{n-1}) = \\
|
||||
& f(d_1) \cdot(x_1-c - (x_0-c)) + f(d_2) \cdot(x_2-c - (x_1-c)) + \cdots + f(d_n) \cdot(x_n-c - (x_{n-1}-c)).
|
||||
f(c_1 -c) \cdot (x_1 - x_0) &+ f(c_2 -c) \cdot (x_2 - x_1) + \cdots\\
|
||||
&\quad + f(c_n -c) \cdot (x_n - x_{n-1})\\
|
||||
&= f(d_1) \cdot(x_1-c - (x_0-c)) + f(d_2) \cdot(x_2-c - (x_1-c)) + \cdots\\
|
||||
&\quad + f(d_n) \cdot(x_n-c - (x_{n-1}-c)).
|
||||
\end{align*}
|
||||
|
||||
|
||||
@@ -636,15 +638,15 @@ With this, we can easily find an approximate answer. We wrote the function to us
|
||||
|
||||
|
||||
```{julia}
|
||||
𝒇(x) = exp(x)
|
||||
riemann(𝒇, 0, 5, 10) # S_10
|
||||
f(x) = exp(x)
|
||||
riemann(f, 0, 5, 10) # S_10
|
||||
```
|
||||
|
||||
Or with more intervals in the partition
|
||||
|
||||
|
||||
```{julia}
|
||||
riemann(𝒇, 0, 5, 50_000)
|
||||
riemann(f, 0, 5, 50_000)
|
||||
```
|
||||
|
||||
(The answer is $e^5 - e^0 = 147.4131591025766\dots$, which shows that even $50,000$ partitions is not enough to guarantee many digits of accuracy.)
|
||||
@@ -719,7 +721,7 @@ We have to be a bit careful with the Riemann sum, as the left Riemann sum will h
|
||||
|
||||
|
||||
```{julia}
|
||||
𝒉(x) = x > 0 ? x * log(x) : 0.0
|
||||
h(x) = x > 0 ? x * log(x) : 0.0
|
||||
```
|
||||
|
||||
This is actually inefficient, as the check for the size of `x` will slow things down a bit. Since we will call this function 50,000 times, we would like to avoid this, if we can. In this case just using the right sum will work:
|
||||
@@ -910,7 +912,8 @@ $$
|
||||
$$
|
||||
|
||||
```{julia}
|
||||
quadgk(x -> x^x, 0, 2)
|
||||
u(x) = x^x
|
||||
quadgk(u, 0, 2)
|
||||
```
|
||||
|
||||
$$
|
||||
|
||||
Reference in New Issue
Block a user