1
$\begingroup$

I have some questions about Mathematica programming and would appreciate if you could help me.

I want to solve a system of ordinary differential equations μ '[t] and λ'[t] and each equation contains a large number of terms so it is impractical to write them explicitly. I express these terms as two functions F1 and F2 that depend on two parameters P1 and P2 and λ[t] and μ[t].

I have been able to solve this system for a couple of initial conditions λ[0] = ic1 and μ[0] = ic2, but I would like to solve my system of equations for a continuum of values ​​λ[0] = {0, ..., Pi/2} and μ[0] = {0, ..., Infinity} and then get λ[t] and μ[t] and use them to perform an integral on λ = λ[0] = {0, ..., Pi/2} and μ = μ[0] = {0, ..., Infinity} that are precisely our initial conditions.

I integrate the product of a function G in the time t (where λ[t] and μ[t] are taken into account for a certain initial condition defined by the continuous ranges of the integral) with the same function, but in t = 0 (where the initial conditions are taken into account with the continuous ranges of the integral).

The structure of the program is:

ode = 
 {μ'[t] == F1[p1, p2, λ[t], μ[t]], 
  λ'[t] == F2[p1, p2, λ[t], μ[t]], 
  μ[0] == {0, ..., Pi/2}, λ[0] == {0, ..., Infinity}};

Sol = NDSolve[ode, {μ, λ}, {t, 0, 1},`Method -> "Some method to choose"]

μ1[t_] := Evaluate[μ[t] /. Sol] // First
λ1[t_] := Evaluate[λ[t] /. Sol] // First

data = 
  ParallelTable[
    {t, 
     NIntegrate[ 
       G[p1, p2, 
         μ1[t] "for the initial condition μ = μ[0]", 
         λ1[t] "for the initial condition λ=λ[0]"] 
       G[p1, p2, 
         μ "= μ[0]", λ "= λ[0]"] , 
         {μ "=`μ[0](initial condition)", 0, Pi/2}, 
         {λ "= λ[0](initial condition)", 0, Infinity}, 
       Method -> {"Some method to choose"}]}, 
       {t, 0, 1}];`
$\endgroup$
  • 4
    $\begingroup$ try ParametricNDSolve and ParametricNDSolveValue? $\endgroup$ – kglr Aug 28 at 2:26
  • $\begingroup$ Ok, but the parameters have values: p1 = 15, p2 = 10. $\endgroup$ – Math Aug 28 at 16:48
  • 2
    $\begingroup$ Please provide a minimal working example. $\endgroup$ – xzczd Oct 4 at 7:40