merge main

This commit is contained in:
jverzani
2025-06-14 07:24:47 -04:00
40 changed files with 151 additions and 122 deletions

View File

@@ -1,11 +1,16 @@
[deps]
CalculusWithJulia = "a2e0e22d-7d4c-5312-9169-8b992201a882"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
Mustache = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PlotlyKaleido = "f2990250-8cf9-495f-b13a-cce12b45703c"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
QuizQuestions = "612c44de-1021-4a21-84fb-7261cf5eb2d4"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
SymPy = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
TextWrap = "b718987f-49a8-5099-9789-dcd902bef87d"

View File

@@ -411,7 +411,7 @@ p = [γ => 0.0,
prob = ODEProblem(sys, u0, TSPAN, p, jac=true)
sol = solve(prob,Tsit5())
plot(t -> sol(t)[3], t -> sol(t)[4], TSPAN..., legend=false)
plot(t -> sol(t)[1], t -> sol(t)[3], TSPAN..., legend=false)
```
The toolkit will automatically generate fast functions and can perform transformations (such as is done by `ode_order_lowering`) before passing along to the numeric solves.

View File

@@ -340,7 +340,7 @@ The first-order initial value equations we have seen can be described generally
$$
\begin{align*}
y'(x) &= F(y,x),\\
y(x_0) &= x_0.
y(x_0) &= y_0.
\end{align*}
$$
@@ -375,7 +375,7 @@ $$
u'(x) = a u(1-u), \quad a > 0
$$
Before beginning, we look at the form of the equation. When $u=0$ or $u=1$ the rate of change is $0$, so we expect the function might be bounded within that range. If not, when $u$ gets bigger than $1$, then the slope is negative and when $u$ gets less than $0$, the slope is positive, so there will at least be a drift back to the range $[0,1]$. Let's see exactly what happens. We define a parameter, restricting `a` to be positive:
Before beginning, we look at the form of the equation. When $u=0$ or $u=1$ the rate of change is $0$, so we expect the function might be bounded within that range. If not, when $u$ gets bigger than $1$, then the slope is negative and though the slope is negative too when $u<0$, but for a realistic problem, it always be $u\ge0$. so we focus $u$ on the range $[0,1]$. Let's see exactly what happens. We define a parameter, restricting `a` to be positive:
```{julia}
@@ -403,7 +403,7 @@ To finish, we call `dsolve` to find a solution (if possible):
out = dsolve(eqn)
```
This answer - to a first-order equation - has one free constant, `C_1`, which can be solved for from an initial condition. We can see that when $a > 0$, as $x$ goes to positive infinity the solution goes to $1$, and when $x$ goes to negative infinity, the solution goes to $0$ and otherwise is trapped in between, as expected.
This answer - to a first-order equation - has one free constant, `C`, which can be solved for from an initial condition. We can see that when $a > 0$, as $x$ goes to positive infinity the solution goes to $1$, and when $x$ goes to negative infinity, the solution goes to $0$ and otherwise is trapped in between, as expected.
The limits are confirmed by investigating the limits of the right-hand:
@@ -420,7 +420,7 @@ We can confirm that the solution is always increasing, hence trapped within $[0,
diff(rhs(out),x)
```
Suppose that $u(0) = 1/2$. Can we solve for $C_1$ symbolically? We can use `solve`, but first we will need to get the symbol for `C_1`:
Suppose that $u(0) = 1/2$. Can we solve for $C_1$ symbolically? We can use `solve`, but first we will need to get the symbol for `C`:
```{julia}