@@ -131,11 +131,18 @@ which trivially applies to sum: ``x_1+x_2=N(\mu_1+\mu_2, \sqrt{\sigma_1^2 + \sig
131131
132132```
133133
134+
135+
134136- it is necessary to define new initialization (functions ` zero ` )
135137- function overloading can be automated (macro, generated functions)
136138
139+ - define nice-looking constructor (`` ± `` )
140+ ``` julia
141+ ± (a:: T ,b:: T ) where T: < Real = GaussNum (a,b)
142+ ```
143+
137144``` julia
138- GX= solve (f,[GaussNum ( 1.0 , 0.1 ), GaussNum ( 1.0 , 0.1 ) ],[0.1 ,0.2 ,0.3 ,0.2 ],0.1 ,1000 )
145+ GX= solve (f,[1.0 ± 0.1 , 1.0 ± 0.1 ],[0.1 ,0.2 ,0.3 ,0.2 ],0.1 ,1000 )
139146```
140147
141148![ ] ( LV_GaussNum.svg )
@@ -147,7 +154,7 @@ The great advantage of the former model was the ability to run an arbitrary code
147154For example, we may know the initial conditions, but do not know the parameter value.
148155
149156``` julia
150- GX= solve (f,[GaussNum ( 1.0 , 0.1 ), GaussNum ( 1.0 , 0.1 ) ],[GaussNum ( 0.1 , 0.1 ) ,0.2 ,0.3 ,0.2 ],0.1 ,1000 )
157+ GX= solve (f,[1.0 ± 0.1 , 1.0 ± 0.1 ],[0.1 ± 0.1 ,0.2 ,0.3 ,0.2 ],0.1 ,1000 )
151158```
152159
153160![ ] ( LV_GaussNum2.svg )
@@ -268,7 +275,7 @@ Easiest solution:
268275- ode, its state and parameters can be wrapped into a ODEProblem
269276
270277``` julia
271- struct ODEProblem{F,T,U,P }
278+ struct ODEProblem{F,T,U<: AbstractVector ,P <: AbstractVector }
272279 f:: F
273280 tspan:: T
274281 u0:: U
@@ -295,18 +302,22 @@ Practical issues:
295302- what if we provide a different
296303- define a type that speficies the type of uncertainty?
297304``` julia
298- struct UncODEProblem
305+ struct UncertainODEProblem
299306 OP:: ODEProblem
300307 unc_in_u # any indexing type accepted by to_index()
301308 unc_in_θ
309+ sqΣ0
302310end
303311```
304312
305313We can dispatch cubature solve on UncODEProblem and solve on UncODEProblem.OP internally.
306314
307315``` julia
308- getuncertainty (o:: UncODEProblem ) = [ o. OP. u0[o. unc_in_u];o. OP. θ[o. unc_in_θ]]
309- setuncertainty! (o:: UncODEProblem ,x:: AbstractVector ) = begin o. u0[o. unc_in_u]= x[1 : 2 ],o. θ[1 ]= x[3 ] end
316+ getmean (o:: UncertainODEProblem ) = [ o. OP. u0[o. unc_in_u];o. OP. θ[o. unc_in_θ]]
317+ setmean! (o:: UncertainODEProblem ,x:: AbstractVector ) = begin
318+ o. OP. u0[o. unc_in_u]= x[1 : length (unc_in_u)]
319+ o. OP. θ[o. unc_in_θ]= x[length (unc_in_u).+ [1 : length (unc_in_θ)]]
320+ end
310321```
311322
312- - smart indexing?
323+ - constructor accepts an ODEProblem with uncertain numbers and converts it
0 commit comments