Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ make sure that `julia` is found in the path. For more
information see the `julia_setup()` function from
[JuliaCall](https://github.com/JuliaInterop/JuliaCall).

## Google Collab Notebooks
## Google Colab Notebooks

As a demonstration, check out the following notebooks:

Expand Down Expand Up @@ -162,7 +162,7 @@ Plotly is much prettier!

If we want to have a more accurate solution, we can send `abstol` and `reltol`. Defaults are `1e-6` and `1e-3` respectively.
Generally you can think of the digits of accuracy as related to 1 plus the exponent of the relative tolerance, so the default is
two digits of accuracy. Absolute tolernace is the accuracy near 0.
two digits of accuracy. Absolute tolerance is the accuracy near 0.

In addition, we may want to choose to save at more time points. We do this by giving an array of values to save at as `saveat`.
Together, this looks like:
Expand Down Expand Up @@ -458,7 +458,7 @@ tspan <- c(0.0, 100.0)
constant_lags <- c(20.0)
JuliaCall::julia_assign("u0", u0)
JuliaCall::julia_assign("tspan", tspan)
JuliaCall::julia_assign("constant_lags", tspan)
JuliaCall::julia_assign("constant_lags", constant_lags)
prob <- JuliaCall::julia_eval("DDEProblem(f, u0, h, tspan, constant_lags = constant_lags)")
sol <- de$solve(prob,de$MethodOfSteps(de$Tsit5()))
udf <- as.data.frame(t(sapply(sol$u,identity)))
Expand Down
4 changes: 2 additions & 2 deletions vignettes/dae.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ differential_vars <- c(TRUE,TRUE,FALSE)
prob <- de$DAEProblem(f,du0,u0,tspan,differential_vars=differential_vars)
sol <- de$solve(prob)
udf <- as.data.frame(t(sapply(sol$u,identity)))
plotly::plot_ly(udf, x = sol$t, y = ~V1, type = 'scatter', mode = 'lines') %>%
plotly::add_trace(y = ~V2) %>%
plotly::plot_ly(udf, x = sol$t, y = ~V1, type = 'scatter', mode = 'lines') |>
plotly::add_trace(y = ~V2) |>
plotly::add_trace(y = ~V3)
```

Expand Down
4 changes: 2 additions & 2 deletions vignettes/dde.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ tspan <- c(0.0, 100.0)
constant_lags <- c(20.0)
JuliaCall::julia_assign("u0", u0)
JuliaCall::julia_assign("tspan", tspan)
JuliaCall::julia_assign("constant_lags", tspan)
JuliaCall::julia_assign("constant_lags", constant_lags)
prob <- JuliaCall::julia_eval("DDEProblem(f, u0, h, tspan, constant_lags = constant_lags)")
sol <- de$solve(prob,de$MethodOfSteps(de$Tsit5()))
udf <- as.data.frame(t(sapply(sol$u,identity)))
plotly::plot_ly(udf, x = sol$t, y = ~V1, type = 'scatter', mode = 'lines') %>% plotly::add_trace(y = ~V2)
plotly::plot_ly(udf, x = sol$t, y = ~V1, type = 'scatter', mode = 'lines') |> plotly::add_trace(y = ~V2)
```

![delay](https://user-images.githubusercontent.com/1814174/39023532-10bdd750-43f0-11e8-837d-156d33ea2f99.png)
Expand Down
6 changes: 5 additions & 1 deletion vignettes/ode.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ This gives back a solution object for which `sol$t` are the time points
and `sol$u` are the values. We can treat the solution as a continuous object
in time via

```R
sol$.(0.2)
```

and a high order interpolation will compute the value at `t=0.2`. We can check
the solution by plotting it:

Expand Down Expand Up @@ -77,7 +81,7 @@ Here we utilized the parameter array `p`. Thus we use `diffeqr::ode.solve` like

```R
u0 <- c(1.0,0.0,0.0)
tspan <- list(0.0,100.0)
tspan <- c(0.0,100.0)
p <- c(10.0,28.0,8/3)
prob <- de$ODEProblem(f, u0, tspan, p)
sol <- de$solve(prob)
Expand Down
2 changes: 1 addition & 1 deletion vignettes/sde.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ g <- function(u,p,t) {
return(0.87*u)
}
u0 <- 1/2
tspan <- list(0.0,1.0)
tspan <- c(0.0,1.0)
prob <- de$SDEProblem(f,g,u0,tspan)
sol <- de$solve(prob)
udf <- as.data.frame(t(sapply(sol$u,identity)))
Expand Down
Loading