use plotly; fix bitrot

This commit is contained in:
jverzani
2024-06-07 13:07:09 -04:00
parent 0bcc8b5a6c
commit 55f37a6dfb
59 changed files with 423 additions and 176 deletions

View File

@@ -9,7 +9,7 @@ This section uses these add-on packages:
```{julia}
using CalculusWithJulia
using Plots
using ImplicitEquations
plotly()
using Roots
using SymPy
```
@@ -23,7 +23,7 @@ Newton's method is not the only algorithm of its kind for identifying zeros of a
## The `find_zero(f, x0)` function
The function `find_zero` from the `Roots` packages provides several different algorithms for finding a zero of a function, including some a derivative-free algorithms for finding zeros when started with an initial guess. The default method is similar to Newton's method in that only a good initial guess is needed. However, the algorithm, while possibly slower in terms of function evaluations and steps, is engineered to be a bit more robust to the choice of initial estimate than Newton's method. (If it finds a bracket, it will use a bisection algorithm which is guaranteed to converge, but can be slower to do so.) Here we see how to call the function:
The function `find_zero` from the `Roots` packages provides several different algorithms for finding a zero of a function, including some derivative-free algorithms for finding zeros when started with a nearby initial guess. The default method is similar to Newton's method in that only a good, initial guess is needed. However, the algorithm, while possibly slower in terms of function evaluations and steps, is engineered to be a bit more robust to the choice of initial estimate than Newton's method. (If it finds a bracket, it will use a bisection algorithm which is guaranteed to converge, but can be slower to do so.) Here we see how to call the function:
```{julia}
@@ -279,10 +279,14 @@ We can see it in action on the sine function. Here we pass in $\lambda$, but i
chandrapatla(sin, 3, 4, λ3, verbose=true)
```
```{julia}
#| output: false
#=
The condition `Φ^2 < ξ < 1 - (1-Φ)^2` can be visualized. Assume `a,b=0,1`, `fa,fb=-1/2,1`, Then `c < a < b`, and `fc` has the same sign as `fa`, but what values of `fc` will satisfy the inequality?
```{julia}
XX```{julia}
ξ(c,fc) = (a-b)/(c-b)
Φ(c,fc) = (fa-fb)/(fc-fb)
Φl(c,fc) = Φ(c,fc)^2
@@ -291,7 +295,7 @@ a,b = 0, 1
fa,fb = -1/2, 1
region = Lt(Φl, ξ) & Lt(ξ,Φr)
plot(region, xlims=(-2,a), ylims=(-3,0))
```
XX```
When `(c,fc)` is in the shaded area, the inverse quadratic step is chosen. We can see that `fc < fa` is needed.
@@ -299,14 +303,16 @@ When `(c,fc)` is in the shaded area, the inverse quadratic step is chosen. We ca
For these values, this area is within the area where a implicit quadratic step will result in a value between `a` and `b`:
```{julia}
XX```{julia}
l(c,fc) = λ3(fa,fb,fc,a,b,c)
region₃ = ImplicitEquations.Lt(l,b) & ImplicitEquations.Gt(l,a)
plot(region₃, xlims=(-2,0), ylims=(-3,0))
```
XX```
There are values in the parameter space where this does not occur.
=#
nothing
```
## Tolerances