I want to symbolically evaluate the following integral (with real positive parameters L1, L2, L3, La, Lb, Lc, a, λ, and ρ):

P[J_, L_] := a*L*λ^(L)*ρ*L*Exp[-ρ*L*Abs[J]]

int = Assuming[
  Element[{La, Lb, Lc, L1, L2, L3, ρ}, PositiveReals], 
   P[J12, L1]*P[J23, La]*P[J24, Lc]*P[J34, Lb]*P[J35, L2]*P[J46, L3]*
    UnitStep[Abs[J23] - Abs[J34]]*
    UnitStep[Abs[h3 + Sign[J35] h5] - Abs[J23] + Abs[J34]]*
    UnitStep[Abs[J23] + Abs[J34] - Abs[h3 + Sign[J35] h5]]*
    UnitStep[Abs[J24] - Abs[J34]]*
    UnitStep[Abs[h4 + Sign[J46] h6] - Abs[J24] + Abs[J34]]*
    UnitStep[Abs[J24] + Abs[J34] - Abs[h4 + Sign[J46] h6]]*
    UnitStep[Abs[J46] - Abs[h6]]*
    UnitStep[Abs[J24 + Sign[J23 J34] (Abs[J34] + Abs[J23] - Abs[h3 + Sign[J35] h5])/2]-Abs[h4 + Sign[J23] Sign[h3 + Sign[J35] h5] ((Abs[h3 + Sign[J35] h5] + (Abs[J23]-Abs[J34]))/2) + Sign[J46] h6]]*
    UnitStep[Abs[J12] - Abs[h2 + Sign[J34] Sign[h3 + Sign[J35] h5] ((Abs[h3 + Sign[J35] h5]-(Abs[J23] - Abs[J34]))/2) + Sign[J24 + Sign[J23 J34] (Abs[J34] + Abs[J23] - Abs[h3 + Sign[J35] h5])/2] (h4 + Sign[J23] Sign[h3 + Sign[J35] h5] ((Abs[h3 + Sign[J35] h5] + (Abs[J23] - Abs[J34]))/2) + Sign[J46] h6)]]*
    UnitStep[Abs[J35] - Abs[h5]]*
    UnitStep[Abs[J23 + Sign[J24 J34] (Abs[J34] + Abs[J24] - Abs[h4 + Sign[J46] h6])/2] -Abs[h3 + Sign[J24] Sign[h4 + Sign[J46] h6] ((Abs[h4 + Sign[J46] h6] + (Abs[J24] -Abs[J34]))/2) + Sign[J35] h5]]*
    UnitStep[Abs[J12] - Abs[h2 + Sign[J34] Sign[h4 + Sign[J46] h6] ((Abs[h4 + Sign[J46] h6] - (Abs[J24] - Abs[J34]))/2) + Sign[J23 + Sign[J24 J34] (Abs[J34] + Abs[J24] - Abs[h4 + Sign[J46] h6])/2] (h3 + Sign[J24] Sign[h4 + Sign[J46] h6] ((Abs[h4 + Sign[J46] h6] + (Abs[J24] - Abs[J34]))/2) + Sign[J35] h5)]]
,{J12, -Infinity, Infinity}, {J23, -Infinity,Infinity}, {J24, -Infinity, Infinity}, {J34, -Infinity, Infinity}, {J35, -Infinity, Infinity}, {J46, -Infinity, Infinity}, {h2, -Infinity, Infinity}, {h3, -Infinity, Infinity}, {h4, -Infinity, Infinity}, {h5, -Infinity,Infinity}, {h6, -Infinity, Infinity}]] 

Running this code I never get an answer (actually I tried for something like 30 minutes without getting any answer, I guess Mathematica should compute it in few seconds). I tried to simplify the integral dividing the integration region in two: J35<0 and J35>0 so that Sign[J35] is -1 and 1 respectively. I tried this strategy also for J34, J23, J24 and J46 together (getting a total of $2^5=32$ different contributions) but the problem is still there: the integral never evaluates.

As an example I provide the following integral, similar but easier:

P[J_, L_] := a*L*λ^(L)*ρ*L*Exp[-ρ*L*Abs[J]]
I1 = Assuming[Element[{La, Lb, Lc, ρ}, PositiveReals], 
  Integrate[P[J12, La]*P[J23, Lb]*P[J13, Lc]*
UnitStep[Abs[J13] -Abs[J12]]*
UnitStep[Abs[J23] - Abs[J12]]*
UnitStep[Abs[J23 + Sign[J13*J12]*0.5*(Abs[J13] + Abs[J12] - h1)] Abs[h2 + Sign[J12]*0.5*(h1 - Abs[J13] + Abs[J12])]]*
UnitStep[Abs[J13 + Sign[J23*J12]*0.5*(Abs[J23] + Abs[J12] - h2)] -Abs[h1 + Sign[J12]*0.5*(h2 - Abs[J23] + Abs[J12])]]
, {J12, -Infinity, Infinity}, {J13, -Infinity, Infinity}, {J23, -Infinity, Infinity}, {h1, Abs[J13] - Abs[J12], Abs[J13] + Abs[J12]},{h2, Abs[J23] - Abs[J12], Abs[J23] + Abs[J12]}]] 

Running the code for I1, in few seconds, I get the following output:

(24. a^3 La^2 Lb Lc λ^(
 La + Lb + Lc))/((La + Lb + Lc)^3 ρ^2)

As you can see in the last example I also tried to implement the UnitStep functions in the integral domains of the different variables. For instance UnitStep[Abs[J46]-Abs[h6]] implies {h6,-Abs[J46],Abs[J46]}, but for it didn't work.

Do you have any suggestion on how to compute the first one?


The first integral is due to a problem in which I have these 11 integral variables: h2, h3, h4, h5, h6, J12, J23, J24, J34, J35, J46, whose integration domain is the real line $\mathbb{R}$. I want to integrate the six functions of the type P[J,L], as inside the Integrate, but only in a sub-region defined by: Abs[J23]>Abs[J34] && Abs[h3+Sign[J35]h5]>Abs[J23]-Abs[J34] && Abs[h3+Sign[J35]h5]<Abs[J23]+Abs[J34] && Abs[J24]>Abs[J34] && Abs[h4+Sign[J46]h6]>Abs[J24]-Abs[J34] && Abs[h4+Sign[J46]h6]<Abs[J24]+Abs[J34]. Since I didn't know how to implement this integrating region I used UnitStep functions, these are the first six UnitStep functions in the integral. The other six UnitStep functions are six Heaviside step functions which arise from my problem. To recap I have to integrate the six P[J,L] functions multiplied by six Heaviside functions (the last six Unitstep functions) over the region (identified before) on the space composed by the reals h2, h3, h4, h5, h6, J12, J23, J24, J34, J35 and J46.

I am referring to a problem of Classical Statistical Mechanics. The problem stems from the computation of the "response" function of a system of six Ising spins: "s1", "s2", "s3", "s4", "s5", "s6" (that is spin "i" can have only +1 or -1 values). The hamiltonian is:

H[s1_, s2_, s3_, s4_, s5_, s6_] := -s1 h1 - s2 h2 - s3 h3 - s4 h4 - s5 h5 - s6 h6 - s1 s2 J12 - s2 s3 J23 - s2 s4 J24 - s3 s4 J34 - s3 s5 J35 - s4 s6 J46

from which we understand that spin "1" is connected with spin "2" since there is J12, which is a coupling constant, and so on. The variables h2, h3, h4, h5, h6 are external magnetic fields. Any of the 11 variables are random real variables and the functions P[J,L] are probability distributions. In this context I analytically found the expression of the "response" function at zero temperature (which should be computed in the region I mentioned before) and contains the last six UnitStep functions, since the response function I defined is zero or 1 at zero temperature, that's why UnitStep functions. That's why I needed this integral. In simpler cases, with less spins it is easy but in this case I don't get an answer.

Implement the region using the UnitStep functions worked for simpler cases (as the example I provided, which is similar) but not in this case.

  • $\begingroup$ What is known about the parameters La,Lb,....? $\endgroup$ Oct 27, 2023 at 15:44
  • $\begingroup$ We know that all the parameters, that are L1, L2, L3, La, Lb, Lc, a, \[Lambda], and \[Rho], are positive real numbers. That's why I used the assumptions in computing the integral. I will add this info in the question, thank you. $\endgroup$ Oct 27, 2023 at 15:56
  • $\begingroup$ Wouldn't assumption Element[{La, Lb, Lc, L1, L2, L3, \[Rho]}, PositiveReals] be much simpler? $\endgroup$ Oct 27, 2023 at 16:03
  • $\begingroup$ Yes it is! I tried with that long series of assumptions and kept it, yours is much simpler. I will change it. $\endgroup$ Oct 27, 2023 at 16:07
  • $\begingroup$ Is there a way to implement the UnitStep functions inside the integral domains? As you did for the second example? For instance UnitStep[Abs[J46]-Abs[h6]] implies {h6,-Abs[J46],Abs[J46]} and so on. $\endgroup$ Oct 29, 2023 at 10:11


Your Answer

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

Browse other questions tagged or ask your own question.