0
$\begingroup$

Newish to Mathematica here. I'm running some code to compute regions of the parameter space where the covariance between innovations is positive or negative. On my Windows PC, it's been running for over a day but hasn't used that much RAM. When submitting to a SLURM cluster, I get an OOM error even when utilizing 96GB of RAM.

Given the complexity of my problem, is this expected behavior, or is it a coding error/bad memory management? Are there any best practices for simplifying the computational complexity of such a problem?

The line below, which causes the overhead begins with exp1 = ....

$Assumptions = ((ρ ∈ PostiveReals) && (ρ < 1));
AppendTo[$Assumptions, β ∈ Reals];
AppendTo[$Assumptions, α ∈ Reals];
AppendTo[$Assumptions, ϕ ∈ PositiveReals ];
AppendTo[$Assumptions, δ ∈ Reals ];
AppendTo[$Assumptions, (Subscript[μ, g]  ∈ PostiveReals) && (Subscript[μ, g]  < 1)];
AppendTo[$Assumptions, (Subscript[μ, π]  ∈ PostiveReals) && (Subscript[μ, π] < 1)];
AppendTo[$Assumptions, Subscript[σ, g] ∈ PositiveReals];
AppendTo[$Assumptions, Subscript[σ, π] ∈ PositiveReals];
AppendTo[$Assumptions, Subscript[σ, r] ∈ PositiveReals];
AppendTo[$Assumptions, Subscript[μ, g] ∈ Reals];
AppendTo[$Assumptions, Subscript[μ, π] ∈ Reals];
AppendTo[$Assumptions, β > -1 / (ϕ*(1 - ρ))]

B0 = {{1, 0, ϕ}, {-δ, 1, 0}, {-(1 - ρ)* β, 0, 1}};

B01Inv =  FullSimplify[Inverse[B0]];
Γ = {{Subscript[σ, g], 0, 0}, {0, Subscript[σ, π], 0}, {0, 0, Subscript[σ, r]}};
B1 = {{Subscript[μ, g], ϕ, 0}, {0, Subscript[μ, π], 0}, {0, (1 - ρ) α, 0}};
Bm1 = {{1 - Subscript[μ, g], 0, 0}, {0, 1 - Subscript[μ, π], 0}, {0, 0, ρ}};

Σ1 = FullSimplify[Inverse[B0] . Γ];
Ω1 = FullSimplify[Σ1 . Transpose[Σ1]]; 


F1= FullSimplify[B01Inv . Bm1];
A1 = FullSimplify[B01Inv . B1];
C1 = FullSimplify[{{1,0,0},{0,1,0},{0,0,1}}- A1 . F1];
Σ2 = FullSimplify[Inverse[C1] . Σ1];
Ω2 = FullSimplify[Σ2 . Transpose[Σ2]];

Print["Starting Computation 1: ", DateString[]]
exp1 = FullSimplify@Reduce[Ω2[[1,2]] > 0] // FullForm
Export["computation_12.m", {exp1}];
Print["Starting Computation 2: ", DateString[]]
exp2 = FullSimplify@Reduce[Ω2[[1,3]] > 0] // FullForm
Export["computation_13.m", {exp2}];
Print["Starting Computation 3: ", DateString[]];
exp3 = FullSimplify@Reduce[Ω2[[2,3]] > 0] // FullForm
Export["computation_23.m", {exp3}];
Print["All Computations Finished at: ", DateString[]]

Export["all_computations.m", {exp1,exp2,exp3}];

Quit[];
$\endgroup$
7
  • 2
    $\begingroup$ In fact, all that FullSimplify do nothing . LeafCount[\[CapitalOmega]2[[1,2]]] produces 13518 , so Reduce[\[CapitalOmega]2[[1, 2]]>0] is too difficult for MMA. $\endgroup$
    – user64494
    Commented Aug 6, 2023 at 19:09
  • 2
    $\begingroup$ Without going through all of your code note that subscripts are not symbols so that is possibly causing issues. You'll find plenty of discussion relating to this on this site $\endgroup$ Commented Aug 6, 2023 at 23:59
  • $\begingroup$ @MikeHoneychurch: Are you serious? Reduce[Subscript[\[Mu], g]^2 < 1, Reals] produces -1 < Subscript[\[Mu], g] < 1. $\endgroup$
    – user64494
    Commented Aug 7, 2023 at 4:34
  • 1
    $\begingroup$ @user64494 There are many possible known pitfalls to using Subscript variables. See eg 1004, 869, 373, and many others. $\endgroup$
    – MarcoB
    Commented Aug 7, 2023 at 8:45
  • $\begingroup$ @MarcoB: Can you ground that Subscript makes troubles in the case under consideration? In other case your words are off-topic. $\endgroup$
    – user64494
    Commented Aug 7, 2023 at 13:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.