Skip to content

Commit

Permalink
Merge pull request #696 from ErikQQY/qqy/update_sdeproblem
Browse files Browse the repository at this point in the history
Update SDEProblem usage in docs
  • Loading branch information
ChrisRackauckas authored Sep 29, 2023
2 parents 12cdd40 + 5629801 commit 7f48b73
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
50 changes: 25 additions & 25 deletions docs/src/features/progress_bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,35 @@ and find tough locations for the solvers.

## Using Progress Bars with VS Code

If using VS Code, progress bars are enabled via the [ProgressLoggers.jl](https://github.com/JuliaLogging/ProgressLogging.jl) package.
If using VS Code, progress bars are enabled via the [ProgressLoggers.jl](https://github.com/JuliaLogging/ProgressLogging.jl) package.
For example:

```julia
using OrdinaryDiffEq, ProgressLogging
function lorenz!(du,u,p,t)
du[1] = 10.0(u[2]-u[1])
du[2] = u[1]*(28.0-u[3]) - u[2]
du[3] = u[1]*u[2] - (8/3)*u[3]
function lorenz!(du, u, p, t)
du[1] = 10.0(u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,1000000.0)
prob = ODEProblem(lorenz!,u0,tspan)
sol = solve(prob,Tsit5(), progress=true)
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 1000000.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, Tsit5(), progress = true)
```

## Using Progress Bars in the Terminal

```julia
using OrdinaryDiffEq, TerminalLoggers
function lorenz!(du,u,p,t)
du[1] = 10.0(u[2]-u[1])
du[2] = u[1]*(28.0-u[3]) - u[2]
du[3] = u[1]*u[2] - (8/3)*u[3]
function lorenz!(du, u, p, t)
du[1] = 10.0(u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,1000000.0)
prob = ODEProblem(lorenz!,u0,tspan)
sol = solve(prob,Tsit5(), progress=true)
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 1000000.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, Tsit5(), progress = true)
```

To use progress bars in the terminal, use [TerminalLoggers.jl](https://github.com/JuliaLogging/TerminalLoggers.jl).
Expand All @@ -63,13 +63,13 @@ using Logging: global_logger
using TerminalLoggers: TerminalLogger
global_logger(TerminalLogger())

function lorenz!(du,u,p,t)
du[1] = 10.0(u[2]-u[1])
du[2] = u[1]*(28.0-u[3]) - u[2]
du[3] = u[1]*u[2] - (8/3)*u[3]
function lorenz!(du, u, p, t)
du[1] = 10.0(u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,1000000.0)
prob = ODEProblem(lorenz!,u0,tspan)
sol = solve(prob,Tsit5(), progress=true, maxiters = 1e8)
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 1000000.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, Tsit5(), progress = true, maxiters = 1e8)
```
2 changes: 1 addition & 1 deletion docs/src/tutorials/sde_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object with:
```@example sde
f_analytic(u₀, p, t, W) = u₀ * exp((α - (β^2) / 2) * t + β * W)
ff = SDEFunction(f, g, analytic = f_analytic)
prob = SDEProblem(ff, g, u₀, (0.0, 1.0))
prob = SDEProblem(ff, u₀, (0.0, 1.0))
```

and then we pass this information to the solver and plot:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/types/sdae_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ function g!(du, u, p, t)
@. du = 0.1
end

prob = SDEProblem(SDEFunction(f!, g!; mass_matrix = mm_A), g!,
prob = SDEProblem(SDEFunction(f!, g!; mass_matrix = mm_A),
ones(3), (0.0, 1.0))
```

0 comments on commit 7f48b73

Please sign in to comment.