commit
071a495010
@ -409,7 +409,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.
|
||||
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user