use quarto, not Pluto to render pages
This commit is contained in:
@@ -16,7 +16,7 @@ const frontmatter = (
|
||||
description = "Calculus with Julia: The `DifferentialEquations` suite",
|
||||
tags = ["CalculusWithJulia", "odes", "the `differentialequations` suite"],
|
||||
);
|
||||
fig_size = (600, 400)
|
||||
fig_size = (800, 600)
|
||||
nothing
|
||||
```
|
||||
|
||||
@@ -152,12 +152,8 @@ end
|
||||
|
||||
The notation `du` is suggestive of both the derivative and a small increment. The mathematical formulation follows the derivative, the numeric solution uses a time step and increments the solution over this time step. The `Tsit5()` solver, used here, adaptively chooses a time step, `dt`; were the `Euler` method used, this time step would need to be explicit.
|
||||
|
||||
```julia; echo=false
|
||||
note("""
|
||||
The `sir!` function has the trailing `!` indicating -- by convention -- it *mutates* its first value, `du`. In this case, through an assignment, as in `du[1]=ds`. This could use some explanation. The *binding* `du` refers to the *container* holding the ``3`` values, whereas `du[1]` refers to the first value in that container. So `du[1]=ds` changes the first value, but not the *binding* of `du` to the container. That is, `du` mutates. This would be quite different were the call `du = [ds,di,dr]` which would create a new *binding* to a new container and not mutate the values in the original container.
|
||||
""", title="Mutation not re-binding")
|
||||
```
|
||||
|
||||
!!! note "Mutation not re-binding"
|
||||
The `sir!` function has the trailing `!` indicating -- by convention -- it *mutates* its first value, `du`. In this case, through an assignment, as in `du[1]=ds`. This could use some explanation. The *binding* `du` refers to the *container* holding the ``3`` values, whereas `du[1]` refers to the first value in that container. So `du[1]=ds` changes the first value, but not the *binding* of `du` to the container. That is, `du` mutates. This would be quite different were the call `du = [ds,di,dr]` which would create a new *binding* to a new container and not mutate the values in the original container.
|
||||
|
||||
With the update function defined, the problem is setup and a solution found with in the same manner:
|
||||
|
||||
@@ -289,12 +285,8 @@ end
|
||||
|
||||
This function ``W`` is just a constant above, but can be easily modified as desired.
|
||||
|
||||
```julia; echo=false
|
||||
note("""
|
||||
The "standard" trick is to take a second order ODE like ``u''(t)=u`` and turn this into two coupled ODEs by using a new name: ``v=u'(t)`` and then ``v'(t) = u(t)``. In this application, there are ``4`` equations, as we have *both* ``x''`` and ``y''`` being so converted. The first and second components of ``du`` are new variables, the third and fourth show the original equation.
|
||||
""", title="A second-order ODE is a coupled first-order ODE")
|
||||
```
|
||||
|
||||
!!! note "A second-order ODE is a coupled first-order ODE"
|
||||
The "standard" trick is to take a second order ODE like ``u''(t)=u`` and turn this into two coupled ODEs by using a new name: ``v=u'(t)`` and then ``v'(t) = u(t)``. In this application, there are ``4`` equations, as we have *both* ``x''`` and ``y''`` being so converted. The first and second components of ``du`` are new variables, the third and fourth show the original equation.
|
||||
|
||||
The initial conditions are specified through:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user