Hi, I’m solving differential equations with different sets of initial conditions, and I’m trying to figure out how to take different linear combinations of the ODE solutions (added, subtracted, multiplied by different scalar factors, etc.).
For example, with solutions obtained with code like:
prob1 = ODEProblem(DiffEquation!, InitConditionsArray1, tspan, ODEParams1) prob2 = ODEProblem(DiffEquation!, InitConditionsArray2, tspan, ODEParams2) soln1 = DifferentialEquations.solve(prob1, Rodas5(), dense=true, reltol=1e-12, abstol=1e-12, maxiters = 1e7, progress=true) soln2 = DifferentialEquations.solve(prob2, Rodas5(), dense=true, reltol=1e-12, abstol=1e-12, maxiters = 1e7, progress=true)
suppose I want to make a combination solution:
solnCombo = 1.5*soln1 - 0.7*soln2.
Is there an easy way to produce this combination as a new variable of the same
(1) The initial conditions are arrays (over spatial variable
x), so these solutions are actually 2-dimensional solutions, functions over a rectangular range of values in
(2) It’s probably easy to save the linear combination in an array by just adding/subtracting each data point in the
ODESolution's. But, those solutions also have interpolation information in them, so I’m wondering if it’s possible to take linear combinations of the whole solutions.
Thanks for any info!