work on limits section
This commit is contained in:
@@ -974,7 +974,7 @@ let
|
||||
F = FnWrapper(f)
|
||||
ans,err = quadgk(F, a, b)
|
||||
plot(f, a, b, legend=false, title="Error ≈ $(round(err,sigdigits=2))")
|
||||
scatter!(F.xs, F.ys)
|
||||
scatter!(F.xs, F.ys)
|
||||
end
|
||||
```
|
||||
|
||||
@@ -1047,6 +1047,23 @@ solve.(Z, (1/4, 1/2, 3/4))
|
||||
|
||||
The middle one is clearly $0$. This distribution is symmetric about $0$, so half the area is to the right of $0$ and half to the left, so clearly when $p=0.5$, $x$ is $0$. The other two show that the area to the left of $-0.809767$ is equal to the area to the right of $0.809767$ and equal to $0.25$.
|
||||
|
||||
##### Example: Gauss nodes
|
||||
|
||||
The `QuadGK.gauss(n)` function returns a pair of $n$ quadrature points and weights to integrate a function over the interval $(-1,1)$, with an option to use a different interval $(a,b)$. For a given $n$, these values exactly integrate any polynomial of degree $2n-1$ or less. The pattern to integrate below can be expressed in other ways, but this is intended to be direct:
|
||||
|
||||
|
||||
```{julia}
|
||||
xs, ws = QuadGK.gauss(5)
|
||||
```
|
||||
|
||||
```{julia}
|
||||
f(x) = exp(cos(x))
|
||||
sum(w * f(x) for (x, w) in zip(xs, ws))
|
||||
```
|
||||
|
||||
The `zip` function is used to iterate over the `xs` and `ws` as pairs of values.
|
||||
|
||||
|
||||
|
||||
## Questions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user