33f = (u,p,t) -> 1.01 u
44σ = (u,p,t) -> 0.87 u
55(ff:: typeof (f))(:: Type{Val{:analytic}} ,u0,p,t,W) = u0.* exp .(0.63155 t+ 0.87 W)
6- """
6+
7+ doc"""
78```math
89du_t = βudt + αudW_t
910```
3233 end
3334end
3435(ff:: typeof (f))(:: Type{Val{:analytic}} ,u0,p,t,W) = u0.* exp .(0.63155 * t+ 0.87 * W)
35- """
36+ doc """
36378 linear SDEs (as a 4x2 matrix):
3738
3839```math
@@ -62,7 +63,7 @@ prob_sde_2Dlinear_stratonovich = SDEProblem(f,σ,ones(4,2)/2,(0.0,1.0))
6263f = (u,p,t) -> - .25 * u* (1 - u^ 2 )
6364σ = (u,p,t) -> .5 * (1 - u^ 2 )
6465(ff:: typeof (f))(:: Type{Val{:analytic}} ,u0,p,t,W) = ((1 + u0). * exp .(W)+ u0- 1 ). / ((1 + u0). * exp .(W)+ 1 - u0)
65- """
66+ doc """
6667```math
6768du_t = \\ frac{1}{4}u(1-u^2)dt + \\ frac{1}{2}(1-u^2)dW_t
6869```
@@ -78,7 +79,7 @@ prob_sde_cubic = SDEProblem(f,σ,1/2,(0.0,1.0))
7879f = (u,p,t) -> - 0.01 * sin .(u).* cos .(u).^ 3
7980σ = (u,p,t) -> 0.1 * cos .(u).^ 2
8081(ff:: typeof (f))(:: Type{Val{:analytic}} ,u0,p,t,W) = atan .(0.1 * W + tan .(u0))
81- """
82+ doc """
8283```math
8384du_t = -\\ frac{1}{100}\s in(u)\c os^3(u)dt + \\ frac{1}{10}\c os^{2}(u_t) dW_t
8485```
@@ -96,7 +97,7 @@ f = (u,p,t) -> p[2]./sqrt.(1+t) - u./(2*(1+t))
9697p = (0.1 ,0.05 )
9798(ff:: typeof (f))(:: Type{Val{:analytic}} ,u0,p,t,W) = u0./ sqrt .(1 + t) + p[2 ]* (t+ p[1 ]* W). / sqrt .(1 + t)
9899
99- """
100+ doc """
100101Additive noise problem
101102
102103```math
126127end
127128(ff:: typeof (f))(:: Type{Val{:analytic}} ,u0,p,t,W) = u0./ sqrt (1 + t) + sde_wave_βvec.* (t+ sde_wave_αvec.* W). / sqrt (1 + t)
128129
129- """
130+ doc """
130131A multiple dimension extension of `additiveSDEExample`
131132
132133"""
@@ -143,7 +144,7 @@ end σ ρ β
143144 du[i] = 3.0 # Additive
144145 end
145146end
146- """
147+ doc """
147148Lorenz Attractor with additive noise
148149
149150```math
@@ -162,7 +163,7 @@ prob_sde_lorenz = SDEProblem(f,σ,ones(3),(0.0,10.0),(10.0,28.0,2.66))
162163f = (u,p,t) -> (1 / 3 )* u^ (1 / 3 ) + 6 * u^ (2 / 3 )
163164σ = (u,p,t) -> u^ (2 / 3 )
164165(ff:: typeof (f))(:: Type{Val{:analytic}} ,u0,p,t,W) = (2 t + 1 + W/ 3 )^ 3
165- """
166+ doc """
166167Runge–Kutta methods for numerical solution of stochastic differential equations
167168Tocino and Ardanuy
168169"""
@@ -316,8 +317,26 @@ function oval2ModelExample(;largeFluctuations=false,useBigs=false,noiseLevel=1)
316317 SDEProblem (f,σ,u0,(0.0 ,500.0 ))
317318end
318319
320+ stiff_quad_f_ito (u,p,t) = - (p[1 ]+ (p[2 ]^ 2 )* u)* (1 - u^ 2 )
321+ stiff_quad_f_strat (u,p,t) = - p[1 ]* (1 - u^ 2 )
322+ stiff_quad_g (u,p,t) = p[2 ]* (1 - u^ 2 )
319323
320- """
324+ function stiff_quad_f_ito (:: Type{Val{:analytic}} ,u0,p,t,W)
325+ α = p[1 ]
326+ β = p[2 ]
327+ exp_tmp = exp (- 2 * α* t+ 2 * β* W)
328+ tmp = 1 + u0
329+ (tmp* exp_tmp + u0 - 1 )/ (tmp* exp_tmp - u0 + 1 )
330+ end
331+ function stiff_quad_f_strat (:: Type{Val{:analytic}} ,u0,p,t,W)
332+ α = p[1 ]
333+ β = p[2 ]
334+ exp_tmp = exp (- 2 * α* t+ 2 * β* W)
335+ tmp = 1 + u0
336+ (tmp* exp_tmp + u0 - 1 )/ (tmp* exp_tmp - u0 + 1 )
337+ end
338+
339+ doc"""
321340The composite Euler method for stiff stochastic
322341differential equations
323342
@@ -334,31 +353,28 @@ Stiffness of Euler is determined by α+β²<1
334353Higher α or β is stiff, with α being deterministic stiffness and
335354β being noise stiffness (and grows by square).
336355"""
337- function generate_stiff_quad (α,β;ito= true )
338- if ito
339- f = function (u,p,t)
340- - (α+ (β^ 2 )* u)* (1 - u^ 2 )
341- end
342- else
343- f = function (u,p,t)
344- - α* (1 - u^ 2 )
345- end
346- end
356+ prob_sde_stiffquadito = SDEProblem (stiff_quad_f_ito,stiff_quad_g,0.5 ,(0.0 ,3.0 ),(1.0 ,1.0 ))
347357
348- function g (u,p,t)
349- β * ( 1 - u ^ 2 )
350- end
358+ doc"""
359+ The composite Euler method for stiff stochastic
360+ differential equations
351361
352- function (:: typeof (f))(:: Type{Val{:analytic}} ,u0,p,t,W)
353- exp_tmp = exp (- 2 * α* t+ 2 * β* W)
354- tmp = 1 + u0
355- (tmp* exp_tmp + u0 - 1 )/ (tmp* exp_tmp - u0 + 1 )
356- end
362+ Kevin Burrage, Tianhai Tian
357363
358- SDEProblem (f,g,0.5 ,(0.0 ,3.0 ))
359- end
364+ And
365+
366+ S-ROCK: CHEBYSHEV METHODS FOR STIFF STOCHASTIC
367+ DIFFERENTIAL EQUATIONS
360368
369+ ASSYR ABDULLE AND STEPHANE CIRILLI
370+
371+ Stiffness of Euler is determined by α+β²<1
372+ Higher α or β is stiff, with α being deterministic stiffness and
373+ β being noise stiffness (and grows by square).
361374"""
375+ prob_sde_stiffquadstrat = SDEProblem (stiff_quad_f_strat,stiff_quad_g,0.5 ,(0.0 ,3.0 ),(1.0 ,1.0 ))
376+
377+ doc"""
362378Stochastic Heat Equation with scalar multiplicative noise
363379
364380S-ROCK: CHEBYSHEV METHODS FOR STIFF STOCHASTIC
@@ -432,6 +448,7 @@ network = @reaction_network rnType begin
432448 p10, SP2 --> 0
433449end p1 p2 p3 p4 p5 p6 p7 p8 p9 p10
434450p = (0.01 ,3.0 ,3.0 ,4.5 ,2. ,15. ,20.0 ,0.005 ,0.01 ,0.05 )
451+
435452"""
436453An oscillatory chemical reaction system
437454"""
0 commit comments