From 1f9a0dbd2e5ecd1fbe55b942df8eafc74bfeaf52 Mon Sep 17 00:00:00 2001 From: Marcelo Forets Date: Wed, 25 Oct 2017 09:57:38 +0200 Subject: [PATCH 1/3] fix broken link and typos --- docs/src/basics/plot.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/basics/plot.md b/docs/src/basics/plot.md index 0a6a87297f..6016e14220 100644 --- a/docs/src/basics/plot.md +++ b/docs/src/basics/plot.md @@ -3,7 +3,7 @@ ## Standard Plots Using the Plot Recipe Plotting functionality is provided by recipes to Plots.jl. To -use plot solutions, simply call the `plot(type)` after importing Plots.jl +plot solutions, simply call the `plot(type)` after importing Plots.jl and the plotter will generate appropriate plots. ```julia @@ -15,7 +15,7 @@ plot(sol) # Plots the solution Many of the types defined in the DiffEq universe, such as `ODESolution`, `ConvergenceSimulation` `WorkPrecision`, etc. have plot recipes to handle the default plotting behavior. Plots can be customized using -[all of the keyword arguments provided by Plots.jl](https://juliaplots.github.io/supported/). +[all of the keyword arguments provided by Plots.jl](http://docs.juliaplots.org/latest/supported/). For example, we can change the plotting backend to the GR package and put a title on the plot by doing: @@ -192,7 +192,7 @@ on the available attributes. ## Plotting Without the Plot Recipe -What if you don't want to use Plots.jl? Odd choice, but that's okay! If differential +What if you don't want to use Plots.jl? Odd choice, but that's okay! If the differential equation was described by a vector of values, then the solution object acts as an `AbstractMatrix` `sol[i,j]` for the `i`th variable at timepoint `j`. You can use this to plot solutions. For example, in PyPlot, Gadfly, GR, etc., you can From e72a1a84e443def9cbd1d667bb83243502749bd2 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 25 Oct 2017 07:23:35 -0700 Subject: [PATCH 2/3] Update monte_carlo.md --- docs/src/features/monte_carlo.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/src/features/monte_carlo.md b/docs/src/features/monte_carlo.md index 14006264ff..6f59d165df 100644 --- a/docs/src/features/monte_carlo.md +++ b/docs/src/features/monte_carlo.md @@ -32,20 +32,29 @@ One can specify a function `prob_func` which changes the problem. For example: ```julia function prob_func(prob,i,repeat) - prob.u0 = randn()*prob.u0 + prob.u0 .= randn()*prob.u0 prob end ``` modifies the initial condition for all of the problems by a standard normal -random number (a different random number per simulation). This can be used -to perform searches over initial values. Note that the parameter `i` is a unique -counter over the simulations. Thus if you have an array of initial conditions `u0_arr`, -you can have the `i`th simulation use the `i`th initial condition via: +random number (a different random number per simulation). Notice that since +problem types are immutable, it uses `.=`. Otherwise, one can just create +a new problem type: ```julia function prob_func(prob,i,repeat) - prob.u0 = u0_arr[i] + ODEProblem(prob.f,randn()*prob.u0,prob.tspan) +end +``` + +This can be used to perform searches over initial values. Note that the parameter `i` is +a unique counter over the simulations. Thus if you have an array of initial conditions +`u0_arr`, you can have the `i`th simulation use the `i`th initial condition via: + +```julia +function prob_func(prob,i,repeat) + prob.u0 .= u0_arr[i] prob end ``` From b2ca773e620caa9b02addbfa89c040f6bd9c35ad Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 25 Oct 2017 07:24:31 -0700 Subject: [PATCH 3/3] Update monte_carlo.md --- docs/src/features/monte_carlo.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/src/features/monte_carlo.md b/docs/src/features/monte_carlo.md index 6f59d165df..6aaadb9e6b 100644 --- a/docs/src/features/monte_carlo.md +++ b/docs/src/features/monte_carlo.md @@ -288,8 +288,7 @@ and use that for calculating the trajectory: ```julia function prob_func(prob,i,repeat) - prob.u0 = rand()*prob.u0 - prob + ODEProblem(prob.f,rand()*prob.u0,prob.tspan) end ``` @@ -431,8 +430,7 @@ Our `prob_func` will simply randomize the initial condition: prob = ODEProblem((t,u)->1.01u,0.5,(0.0,1.0)) function prob_func(prob,i,repeat) - prob.u0 = rand()*prob.u0 - prob + ODEProblem(prob.f,rand()*prob.u0,prob.tspan) end ```