Compute unstable integral with high precisionHelp at speeding up simplification/nested symbolic integrationHow to do multi-dimensional principal value integration?A 1D numerical integral Mathematica cannot compute, from physicsUsing DeleteCases to ignore term of Producthow to get table (with lists of arguments and values) from numerically obtained function?Parallelization of Monte Carlo numerical integrationTriple integral with dependent parameters2d vs 1d FourierTransformHow to compute this integral with a better precision?Precision control of double integral with $iepsilon$ prescription

What are good ways to spray paint a QR code on a footpath?

Should I hide continue button until tasks are completed?

Three column layout

Why does the numerical solution of an ODE move away from an unstable equilibrium?

What does 2>&1 | tee mean?

Why won't the ground take my seed?

How well known and how commonly used was Huffman coding in 1979?

AT system without -5v

Is there any set of 2-6 notes that doesn't have a chord name?

How hard is it to sell a home which is currently mortgaged?

A player is constantly pestering me about rules, what do I do as a DM?

Do we or do we not observe (measure) superpositions all the time?

How to modify the uneven space between separate loop cuts, while they are already cut?

SPI Waveform on Raspberry Pi Not clean and I'm wondering why

What is the line crossing the Pacific Ocean that is shown on maps?

Generate and graph the Recamán Sequence

Compute unstable integral with high precision

How can I check type T is among parameter pack Ts... in C++?

Why isn’t the tax system continuous rather than bracketed?

Why is Madam Hooch not a professor?

“Transitive verb” + interrupter+ “object”?

Transitive action of a discrete group on a compact space

Should I report a leak of confidential HR information?

How can I convince my reader that I will not use a certain trope?



Compute unstable integral with high precision


Help at speeding up simplification/nested symbolic integrationHow to do multi-dimensional principal value integration?A 1D numerical integral Mathematica cannot compute, from physicsUsing DeleteCases to ignore term of Producthow to get table (with lists of arguments and values) from numerically obtained function?Parallelization of Monte Carlo numerical integrationTriple integral with dependent parameters2d vs 1d FourierTransformHow to compute this integral with a better precision?Precision control of double integral with $iepsilon$ prescription






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1












$begingroup$


I want to calculate
$$
int_mathbbR^n e^-t_1^4-t_2^4- ...-t_n^4-(1-t_1-t_2-...-t_n)^4 textdt_1 textdt_2 ... textdt_n
$$

with the highest possible n.



I tried with



Module[n = 3, intVars, poly,
intVars = Table[Subscript[t, i], -∞, ∞, i, 1, n - 1];
poly = Sum[Subscript[t, i]^4, i, 1, n - 1] + (1 - Sum[Subscript[t, i], i, 1, n - 1])^4;

Print[E^-poly];

NIntegrate[E^-poly, ##, Method -> Automatic, "SymbolicProcessing" -> 0] & @@ intVars
]


which seems to work well only for n<6.
Is there any trick I can use?










share|improve this question











$endgroup$











  • $begingroup$
    Play with NIntegrate[E^-poly, ##, Method -> "QuasiMonteCarlo", "SymbolicProcessing" -> 0, AccuracyGoal -> 3, PrecisionGoal -> 3, WorkingPrecision -> 30] & @@ intVars]. It works for $n=19$.
    $endgroup$
    – user64494
    7 hours ago










  • $begingroup$
    You cannot calculate a high-dimensional integral with high precision. Read the tutorial: "For low-dimensional integrals, the default setting for PrecisionGoal is related to WorkingPrecision. For high-dimensional integrals, it is typically taken to be a fixed value, usually 2. "
    $endgroup$
    – Alex Trounev
    7 hours ago










  • $begingroup$
    @Alex Trounev: You are right. My idea is unsufficiently considered.
    $endgroup$
    – user64494
    7 hours ago

















1












$begingroup$


I want to calculate
$$
int_mathbbR^n e^-t_1^4-t_2^4- ...-t_n^4-(1-t_1-t_2-...-t_n)^4 textdt_1 textdt_2 ... textdt_n
$$

with the highest possible n.



I tried with



Module[n = 3, intVars, poly,
intVars = Table[Subscript[t, i], -∞, ∞, i, 1, n - 1];
poly = Sum[Subscript[t, i]^4, i, 1, n - 1] + (1 - Sum[Subscript[t, i], i, 1, n - 1])^4;

Print[E^-poly];

NIntegrate[E^-poly, ##, Method -> Automatic, "SymbolicProcessing" -> 0] & @@ intVars
]


which seems to work well only for n<6.
Is there any trick I can use?










share|improve this question











$endgroup$











  • $begingroup$
    Play with NIntegrate[E^-poly, ##, Method -> "QuasiMonteCarlo", "SymbolicProcessing" -> 0, AccuracyGoal -> 3, PrecisionGoal -> 3, WorkingPrecision -> 30] & @@ intVars]. It works for $n=19$.
    $endgroup$
    – user64494
    7 hours ago










  • $begingroup$
    You cannot calculate a high-dimensional integral with high precision. Read the tutorial: "For low-dimensional integrals, the default setting for PrecisionGoal is related to WorkingPrecision. For high-dimensional integrals, it is typically taken to be a fixed value, usually 2. "
    $endgroup$
    – Alex Trounev
    7 hours ago










  • $begingroup$
    @Alex Trounev: You are right. My idea is unsufficiently considered.
    $endgroup$
    – user64494
    7 hours ago













1












1








1


1



$begingroup$


I want to calculate
$$
int_mathbbR^n e^-t_1^4-t_2^4- ...-t_n^4-(1-t_1-t_2-...-t_n)^4 textdt_1 textdt_2 ... textdt_n
$$

with the highest possible n.



I tried with



Module[n = 3, intVars, poly,
intVars = Table[Subscript[t, i], -∞, ∞, i, 1, n - 1];
poly = Sum[Subscript[t, i]^4, i, 1, n - 1] + (1 - Sum[Subscript[t, i], i, 1, n - 1])^4;

Print[E^-poly];

NIntegrate[E^-poly, ##, Method -> Automatic, "SymbolicProcessing" -> 0] & @@ intVars
]


which seems to work well only for n<6.
Is there any trick I can use?










share|improve this question











$endgroup$




I want to calculate
$$
int_mathbbR^n e^-t_1^4-t_2^4- ...-t_n^4-(1-t_1-t_2-...-t_n)^4 textdt_1 textdt_2 ... textdt_n
$$

with the highest possible n.



I tried with



Module[n = 3, intVars, poly,
intVars = Table[Subscript[t, i], -∞, ∞, i, 1, n - 1];
poly = Sum[Subscript[t, i]^4, i, 1, n - 1] + (1 - Sum[Subscript[t, i], i, 1, n - 1])^4;

Print[E^-poly];

NIntegrate[E^-poly, ##, Method -> Automatic, "SymbolicProcessing" -> 0] & @@ intVars
]


which seems to work well only for n<6.
Is there any trick I can use?







calculus-and-analysis numerical-integration numerics precision-and-accuracy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 5 hours ago









Carl Woll

85.4k3 gold badges109 silver badges220 bronze badges




85.4k3 gold badges109 silver badges220 bronze badges










asked 8 hours ago









m137m137

1635 bronze badges




1635 bronze badges











  • $begingroup$
    Play with NIntegrate[E^-poly, ##, Method -> "QuasiMonteCarlo", "SymbolicProcessing" -> 0, AccuracyGoal -> 3, PrecisionGoal -> 3, WorkingPrecision -> 30] & @@ intVars]. It works for $n=19$.
    $endgroup$
    – user64494
    7 hours ago










  • $begingroup$
    You cannot calculate a high-dimensional integral with high precision. Read the tutorial: "For low-dimensional integrals, the default setting for PrecisionGoal is related to WorkingPrecision. For high-dimensional integrals, it is typically taken to be a fixed value, usually 2. "
    $endgroup$
    – Alex Trounev
    7 hours ago










  • $begingroup$
    @Alex Trounev: You are right. My idea is unsufficiently considered.
    $endgroup$
    – user64494
    7 hours ago
















  • $begingroup$
    Play with NIntegrate[E^-poly, ##, Method -> "QuasiMonteCarlo", "SymbolicProcessing" -> 0, AccuracyGoal -> 3, PrecisionGoal -> 3, WorkingPrecision -> 30] & @@ intVars]. It works for $n=19$.
    $endgroup$
    – user64494
    7 hours ago










  • $begingroup$
    You cannot calculate a high-dimensional integral with high precision. Read the tutorial: "For low-dimensional integrals, the default setting for PrecisionGoal is related to WorkingPrecision. For high-dimensional integrals, it is typically taken to be a fixed value, usually 2. "
    $endgroup$
    – Alex Trounev
    7 hours ago










  • $begingroup$
    @Alex Trounev: You are right. My idea is unsufficiently considered.
    $endgroup$
    – user64494
    7 hours ago















$begingroup$
Play with NIntegrate[E^-poly, ##, Method -> "QuasiMonteCarlo", "SymbolicProcessing" -> 0, AccuracyGoal -> 3, PrecisionGoal -> 3, WorkingPrecision -> 30] & @@ intVars]. It works for $n=19$.
$endgroup$
– user64494
7 hours ago




$begingroup$
Play with NIntegrate[E^-poly, ##, Method -> "QuasiMonteCarlo", "SymbolicProcessing" -> 0, AccuracyGoal -> 3, PrecisionGoal -> 3, WorkingPrecision -> 30] & @@ intVars]. It works for $n=19$.
$endgroup$
– user64494
7 hours ago












$begingroup$
You cannot calculate a high-dimensional integral with high precision. Read the tutorial: "For low-dimensional integrals, the default setting for PrecisionGoal is related to WorkingPrecision. For high-dimensional integrals, it is typically taken to be a fixed value, usually 2. "
$endgroup$
– Alex Trounev
7 hours ago




$begingroup$
You cannot calculate a high-dimensional integral with high precision. Read the tutorial: "For low-dimensional integrals, the default setting for PrecisionGoal is related to WorkingPrecision. For high-dimensional integrals, it is typically taken to be a fixed value, usually 2. "
$endgroup$
– Alex Trounev
7 hours ago












$begingroup$
@Alex Trounev: You are right. My idea is unsufficiently considered.
$endgroup$
– user64494
7 hours ago




$begingroup$
@Alex Trounev: You are right. My idea is unsufficiently considered.
$endgroup$
– user64494
7 hours ago










2 Answers
2






active

oldest

votes


















3












$begingroup$

One idea I like to use for these kinds of integrals is to add an auxiliary variable and a Dirac delta function, convert the Dirac delta function to it's integral formulation, and then do a bunch of simple 1D integrals. For your case, this would proceed as follows, starting from:



$$undersettin mathbbR^nint e^-t_1^4-t_2^4-ldots
-t_n^4-left(1-t_1-t_2-ldots -t_nright)^4$$



Introduce the auxiliary variable $s$ and add a Dirac delta function:



$$undersettin mathbbR^nint undersetsin
mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 delta(1-t_1-t_2-ldots -t_n-s)$$



Next, introduce the integral formulation of the Dirac delta function:



$$frac12 pi undersettin
mathbbR^nint undersetsin mathbbRint undersetuin
mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 e^i u-i t_1 u-i t_2
u-ldots -i t_n u-i s u$$



Finally, we can do all of the $t$ and $s$ integrals to obtain:



$$frac12 pi int_-infty
^infty e^i u g(u)^n+1 , du$$



where:



$$g(u)=int_-infty ^infty e^-i t u-t^4 , dt$$



Now, let's have Mathematica do these integrals:



g[u_] = Sqrt[2 Pi] FourierTransform[Exp[-t^4], t, u]



2 Gamma[5/4] HypergeometricPFQ[, 1/2, 3/4, u^4/256] -
1/4 u^2 Gamma[3/4] HypergeometricPFQ[, 5/4, 3/2, u^4/256]




So, the desired integral has become:



int[n_, opts:OptionsPattern[NIntegrate]] := (1/(2 Pi)) NIntegrate[
Cos[u] g[u]^(n+1),
u, -Infinity, Infinity,
opts,
Method->"GlobalAdaptive", Method->"GaussKronrodRule"
]


Now, g[u] is real:



Refine[g[u] ∈ Reals, u ∈ Reals]



True




so I use Cos[u] instead of Exp[I u] since the integral is real. I also customize the integration method. Let's check:



int[2, WorkingPrecision->20]
int[2, WorkingPrecision->40]
int[2, WorkingPrecision->60]



1.4733172914977911077



1.473317291497785926905017339845596712841



1.47331729149778592690501733984559670949096610342311667206502




The result seems correct, and improves with higher working precision. Now, for higher orders:



int[4, WorkingPrecision -> 20]
int[5, WorkingPrecision -> 20]
int[6, WorkingPrecision -> 20]
int[40, WorkingPrecision -> 20]



4.4732305211180348293



7.7543594355221995796



13.461688085347942892



4.0351905913672630176*10^9







share|improve this answer











$endgroup$












  • $begingroup$
    You change the order of the integration in the above. This is not a simple matter for improper integrals. Next, in the integral presentation of DiracDelta the principal value is taken.
    $endgroup$
    – user64494
    5 hours ago











  • $begingroup$
    @user64494 What makes you say g[u] is complex valued? I don't think it is. As for order of integration, I haven't been rigorous in proving that it is possible to do so, but the results seem correct, and that is sufficient for me.
    $endgroup$
    – Carl Woll
    5 hours ago










  • $begingroup$
    You are right concerning g[u]. However, other remarks of me remain open. The statement "the results seem correct" is not based.
    $endgroup$
    – user64494
    4 hours ago










  • $begingroup$
    Also int[40, WorkingPrecision -> 20] performs a lot of errors and (1/(2 [Pi]))NIntegrate[ Cos[u] g[u]^(40 + 1), u, -[Infinity], [Infinity], WorkingPrecision -> 20, Method -> "GlobalAdaptive", Method -> "GaussKronrodRule"] in version11.3. PS. The same issue in version 12.0.
    $endgroup$
    – user64494
    4 hours ago











  • $begingroup$
    @user64494 You probably have lingering definitions. Try using Clear[int] and then run the code again.
    $endgroup$
    – Carl Woll
    4 hours ago



















0












$begingroup$

We can increase n, reducing the accuracy of calculations, for example



f[m_, p_] := 
Block[n = m, $MinPrecision = p, $MaxPrecision = p,
intVars =
Table[Subscript[t, i], -[Infinity], [Infinity], i, 1, n];
poly = Sum[
Subscript[t, i]^4, i, 1,
n] + (1 - Sum[Subscript[t, i], i, 1, n])^4;
NIntegrate[E^-poly, ##, PrecisionGoal -> p/2,
AccuracyGoal -> p/2] & @@ intVars]
f[4, 6]

(* 4.47148*)

f[5, 4]

(* 7.75615*)

f[6, 2]

(* 15.8289*)





share|improve this answer









$endgroup$















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f200889%2fcompute-unstable-integral-with-high-precision%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3












    $begingroup$

    One idea I like to use for these kinds of integrals is to add an auxiliary variable and a Dirac delta function, convert the Dirac delta function to it's integral formulation, and then do a bunch of simple 1D integrals. For your case, this would proceed as follows, starting from:



    $$undersettin mathbbR^nint e^-t_1^4-t_2^4-ldots
    -t_n^4-left(1-t_1-t_2-ldots -t_nright)^4$$



    Introduce the auxiliary variable $s$ and add a Dirac delta function:



    $$undersettin mathbbR^nint undersetsin
    mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 delta(1-t_1-t_2-ldots -t_n-s)$$



    Next, introduce the integral formulation of the Dirac delta function:



    $$frac12 pi undersettin
    mathbbR^nint undersetsin mathbbRint undersetuin
    mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 e^i u-i t_1 u-i t_2
    u-ldots -i t_n u-i s u$$



    Finally, we can do all of the $t$ and $s$ integrals to obtain:



    $$frac12 pi int_-infty
    ^infty e^i u g(u)^n+1 , du$$



    where:



    $$g(u)=int_-infty ^infty e^-i t u-t^4 , dt$$



    Now, let's have Mathematica do these integrals:



    g[u_] = Sqrt[2 Pi] FourierTransform[Exp[-t^4], t, u]



    2 Gamma[5/4] HypergeometricPFQ[, 1/2, 3/4, u^4/256] -
    1/4 u^2 Gamma[3/4] HypergeometricPFQ[, 5/4, 3/2, u^4/256]




    So, the desired integral has become:



    int[n_, opts:OptionsPattern[NIntegrate]] := (1/(2 Pi)) NIntegrate[
    Cos[u] g[u]^(n+1),
    u, -Infinity, Infinity,
    opts,
    Method->"GlobalAdaptive", Method->"GaussKronrodRule"
    ]


    Now, g[u] is real:



    Refine[g[u] ∈ Reals, u ∈ Reals]



    True




    so I use Cos[u] instead of Exp[I u] since the integral is real. I also customize the integration method. Let's check:



    int[2, WorkingPrecision->20]
    int[2, WorkingPrecision->40]
    int[2, WorkingPrecision->60]



    1.4733172914977911077



    1.473317291497785926905017339845596712841



    1.47331729149778592690501733984559670949096610342311667206502




    The result seems correct, and improves with higher working precision. Now, for higher orders:



    int[4, WorkingPrecision -> 20]
    int[5, WorkingPrecision -> 20]
    int[6, WorkingPrecision -> 20]
    int[40, WorkingPrecision -> 20]



    4.4732305211180348293



    7.7543594355221995796



    13.461688085347942892



    4.0351905913672630176*10^9







    share|improve this answer











    $endgroup$












    • $begingroup$
      You change the order of the integration in the above. This is not a simple matter for improper integrals. Next, in the integral presentation of DiracDelta the principal value is taken.
      $endgroup$
      – user64494
      5 hours ago











    • $begingroup$
      @user64494 What makes you say g[u] is complex valued? I don't think it is. As for order of integration, I haven't been rigorous in proving that it is possible to do so, but the results seem correct, and that is sufficient for me.
      $endgroup$
      – Carl Woll
      5 hours ago










    • $begingroup$
      You are right concerning g[u]. However, other remarks of me remain open. The statement "the results seem correct" is not based.
      $endgroup$
      – user64494
      4 hours ago










    • $begingroup$
      Also int[40, WorkingPrecision -> 20] performs a lot of errors and (1/(2 [Pi]))NIntegrate[ Cos[u] g[u]^(40 + 1), u, -[Infinity], [Infinity], WorkingPrecision -> 20, Method -> "GlobalAdaptive", Method -> "GaussKronrodRule"] in version11.3. PS. The same issue in version 12.0.
      $endgroup$
      – user64494
      4 hours ago











    • $begingroup$
      @user64494 You probably have lingering definitions. Try using Clear[int] and then run the code again.
      $endgroup$
      – Carl Woll
      4 hours ago
















    3












    $begingroup$

    One idea I like to use for these kinds of integrals is to add an auxiliary variable and a Dirac delta function, convert the Dirac delta function to it's integral formulation, and then do a bunch of simple 1D integrals. For your case, this would proceed as follows, starting from:



    $$undersettin mathbbR^nint e^-t_1^4-t_2^4-ldots
    -t_n^4-left(1-t_1-t_2-ldots -t_nright)^4$$



    Introduce the auxiliary variable $s$ and add a Dirac delta function:



    $$undersettin mathbbR^nint undersetsin
    mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 delta(1-t_1-t_2-ldots -t_n-s)$$



    Next, introduce the integral formulation of the Dirac delta function:



    $$frac12 pi undersettin
    mathbbR^nint undersetsin mathbbRint undersetuin
    mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 e^i u-i t_1 u-i t_2
    u-ldots -i t_n u-i s u$$



    Finally, we can do all of the $t$ and $s$ integrals to obtain:



    $$frac12 pi int_-infty
    ^infty e^i u g(u)^n+1 , du$$



    where:



    $$g(u)=int_-infty ^infty e^-i t u-t^4 , dt$$



    Now, let's have Mathematica do these integrals:



    g[u_] = Sqrt[2 Pi] FourierTransform[Exp[-t^4], t, u]



    2 Gamma[5/4] HypergeometricPFQ[, 1/2, 3/4, u^4/256] -
    1/4 u^2 Gamma[3/4] HypergeometricPFQ[, 5/4, 3/2, u^4/256]




    So, the desired integral has become:



    int[n_, opts:OptionsPattern[NIntegrate]] := (1/(2 Pi)) NIntegrate[
    Cos[u] g[u]^(n+1),
    u, -Infinity, Infinity,
    opts,
    Method->"GlobalAdaptive", Method->"GaussKronrodRule"
    ]


    Now, g[u] is real:



    Refine[g[u] ∈ Reals, u ∈ Reals]



    True




    so I use Cos[u] instead of Exp[I u] since the integral is real. I also customize the integration method. Let's check:



    int[2, WorkingPrecision->20]
    int[2, WorkingPrecision->40]
    int[2, WorkingPrecision->60]



    1.4733172914977911077



    1.473317291497785926905017339845596712841



    1.47331729149778592690501733984559670949096610342311667206502




    The result seems correct, and improves with higher working precision. Now, for higher orders:



    int[4, WorkingPrecision -> 20]
    int[5, WorkingPrecision -> 20]
    int[6, WorkingPrecision -> 20]
    int[40, WorkingPrecision -> 20]



    4.4732305211180348293



    7.7543594355221995796



    13.461688085347942892



    4.0351905913672630176*10^9







    share|improve this answer











    $endgroup$












    • $begingroup$
      You change the order of the integration in the above. This is not a simple matter for improper integrals. Next, in the integral presentation of DiracDelta the principal value is taken.
      $endgroup$
      – user64494
      5 hours ago











    • $begingroup$
      @user64494 What makes you say g[u] is complex valued? I don't think it is. As for order of integration, I haven't been rigorous in proving that it is possible to do so, but the results seem correct, and that is sufficient for me.
      $endgroup$
      – Carl Woll
      5 hours ago










    • $begingroup$
      You are right concerning g[u]. However, other remarks of me remain open. The statement "the results seem correct" is not based.
      $endgroup$
      – user64494
      4 hours ago










    • $begingroup$
      Also int[40, WorkingPrecision -> 20] performs a lot of errors and (1/(2 [Pi]))NIntegrate[ Cos[u] g[u]^(40 + 1), u, -[Infinity], [Infinity], WorkingPrecision -> 20, Method -> "GlobalAdaptive", Method -> "GaussKronrodRule"] in version11.3. PS. The same issue in version 12.0.
      $endgroup$
      – user64494
      4 hours ago











    • $begingroup$
      @user64494 You probably have lingering definitions. Try using Clear[int] and then run the code again.
      $endgroup$
      – Carl Woll
      4 hours ago














    3












    3








    3





    $begingroup$

    One idea I like to use for these kinds of integrals is to add an auxiliary variable and a Dirac delta function, convert the Dirac delta function to it's integral formulation, and then do a bunch of simple 1D integrals. For your case, this would proceed as follows, starting from:



    $$undersettin mathbbR^nint e^-t_1^4-t_2^4-ldots
    -t_n^4-left(1-t_1-t_2-ldots -t_nright)^4$$



    Introduce the auxiliary variable $s$ and add a Dirac delta function:



    $$undersettin mathbbR^nint undersetsin
    mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 delta(1-t_1-t_2-ldots -t_n-s)$$



    Next, introduce the integral formulation of the Dirac delta function:



    $$frac12 pi undersettin
    mathbbR^nint undersetsin mathbbRint undersetuin
    mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 e^i u-i t_1 u-i t_2
    u-ldots -i t_n u-i s u$$



    Finally, we can do all of the $t$ and $s$ integrals to obtain:



    $$frac12 pi int_-infty
    ^infty e^i u g(u)^n+1 , du$$



    where:



    $$g(u)=int_-infty ^infty e^-i t u-t^4 , dt$$



    Now, let's have Mathematica do these integrals:



    g[u_] = Sqrt[2 Pi] FourierTransform[Exp[-t^4], t, u]



    2 Gamma[5/4] HypergeometricPFQ[, 1/2, 3/4, u^4/256] -
    1/4 u^2 Gamma[3/4] HypergeometricPFQ[, 5/4, 3/2, u^4/256]




    So, the desired integral has become:



    int[n_, opts:OptionsPattern[NIntegrate]] := (1/(2 Pi)) NIntegrate[
    Cos[u] g[u]^(n+1),
    u, -Infinity, Infinity,
    opts,
    Method->"GlobalAdaptive", Method->"GaussKronrodRule"
    ]


    Now, g[u] is real:



    Refine[g[u] ∈ Reals, u ∈ Reals]



    True




    so I use Cos[u] instead of Exp[I u] since the integral is real. I also customize the integration method. Let's check:



    int[2, WorkingPrecision->20]
    int[2, WorkingPrecision->40]
    int[2, WorkingPrecision->60]



    1.4733172914977911077



    1.473317291497785926905017339845596712841



    1.47331729149778592690501733984559670949096610342311667206502




    The result seems correct, and improves with higher working precision. Now, for higher orders:



    int[4, WorkingPrecision -> 20]
    int[5, WorkingPrecision -> 20]
    int[6, WorkingPrecision -> 20]
    int[40, WorkingPrecision -> 20]



    4.4732305211180348293



    7.7543594355221995796



    13.461688085347942892



    4.0351905913672630176*10^9







    share|improve this answer











    $endgroup$



    One idea I like to use for these kinds of integrals is to add an auxiliary variable and a Dirac delta function, convert the Dirac delta function to it's integral formulation, and then do a bunch of simple 1D integrals. For your case, this would proceed as follows, starting from:



    $$undersettin mathbbR^nint e^-t_1^4-t_2^4-ldots
    -t_n^4-left(1-t_1-t_2-ldots -t_nright)^4$$



    Introduce the auxiliary variable $s$ and add a Dirac delta function:



    $$undersettin mathbbR^nint undersetsin
    mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 delta(1-t_1-t_2-ldots -t_n-s)$$



    Next, introduce the integral formulation of the Dirac delta function:



    $$frac12 pi undersettin
    mathbbR^nint undersetsin mathbbRint undersetuin
    mathbbRint e^-t_1^4-t_2^4-ldots -t_n^4-s^4 e^i u-i t_1 u-i t_2
    u-ldots -i t_n u-i s u$$



    Finally, we can do all of the $t$ and $s$ integrals to obtain:



    $$frac12 pi int_-infty
    ^infty e^i u g(u)^n+1 , du$$



    where:



    $$g(u)=int_-infty ^infty e^-i t u-t^4 , dt$$



    Now, let's have Mathematica do these integrals:



    g[u_] = Sqrt[2 Pi] FourierTransform[Exp[-t^4], t, u]



    2 Gamma[5/4] HypergeometricPFQ[, 1/2, 3/4, u^4/256] -
    1/4 u^2 Gamma[3/4] HypergeometricPFQ[, 5/4, 3/2, u^4/256]




    So, the desired integral has become:



    int[n_, opts:OptionsPattern[NIntegrate]] := (1/(2 Pi)) NIntegrate[
    Cos[u] g[u]^(n+1),
    u, -Infinity, Infinity,
    opts,
    Method->"GlobalAdaptive", Method->"GaussKronrodRule"
    ]


    Now, g[u] is real:



    Refine[g[u] ∈ Reals, u ∈ Reals]



    True




    so I use Cos[u] instead of Exp[I u] since the integral is real. I also customize the integration method. Let's check:



    int[2, WorkingPrecision->20]
    int[2, WorkingPrecision->40]
    int[2, WorkingPrecision->60]



    1.4733172914977911077



    1.473317291497785926905017339845596712841



    1.47331729149778592690501733984559670949096610342311667206502




    The result seems correct, and improves with higher working precision. Now, for higher orders:



    int[4, WorkingPrecision -> 20]
    int[5, WorkingPrecision -> 20]
    int[6, WorkingPrecision -> 20]
    int[40, WorkingPrecision -> 20]



    4.4732305211180348293



    7.7543594355221995796



    13.461688085347942892



    4.0351905913672630176*10^9








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 4 hours ago

























    answered 5 hours ago









    Carl WollCarl Woll

    85.4k3 gold badges109 silver badges220 bronze badges




    85.4k3 gold badges109 silver badges220 bronze badges











    • $begingroup$
      You change the order of the integration in the above. This is not a simple matter for improper integrals. Next, in the integral presentation of DiracDelta the principal value is taken.
      $endgroup$
      – user64494
      5 hours ago











    • $begingroup$
      @user64494 What makes you say g[u] is complex valued? I don't think it is. As for order of integration, I haven't been rigorous in proving that it is possible to do so, but the results seem correct, and that is sufficient for me.
      $endgroup$
      – Carl Woll
      5 hours ago










    • $begingroup$
      You are right concerning g[u]. However, other remarks of me remain open. The statement "the results seem correct" is not based.
      $endgroup$
      – user64494
      4 hours ago










    • $begingroup$
      Also int[40, WorkingPrecision -> 20] performs a lot of errors and (1/(2 [Pi]))NIntegrate[ Cos[u] g[u]^(40 + 1), u, -[Infinity], [Infinity], WorkingPrecision -> 20, Method -> "GlobalAdaptive", Method -> "GaussKronrodRule"] in version11.3. PS. The same issue in version 12.0.
      $endgroup$
      – user64494
      4 hours ago











    • $begingroup$
      @user64494 You probably have lingering definitions. Try using Clear[int] and then run the code again.
      $endgroup$
      – Carl Woll
      4 hours ago

















    • $begingroup$
      You change the order of the integration in the above. This is not a simple matter for improper integrals. Next, in the integral presentation of DiracDelta the principal value is taken.
      $endgroup$
      – user64494
      5 hours ago











    • $begingroup$
      @user64494 What makes you say g[u] is complex valued? I don't think it is. As for order of integration, I haven't been rigorous in proving that it is possible to do so, but the results seem correct, and that is sufficient for me.
      $endgroup$
      – Carl Woll
      5 hours ago










    • $begingroup$
      You are right concerning g[u]. However, other remarks of me remain open. The statement "the results seem correct" is not based.
      $endgroup$
      – user64494
      4 hours ago










    • $begingroup$
      Also int[40, WorkingPrecision -> 20] performs a lot of errors and (1/(2 [Pi]))NIntegrate[ Cos[u] g[u]^(40 + 1), u, -[Infinity], [Infinity], WorkingPrecision -> 20, Method -> "GlobalAdaptive", Method -> "GaussKronrodRule"] in version11.3. PS. The same issue in version 12.0.
      $endgroup$
      – user64494
      4 hours ago











    • $begingroup$
      @user64494 You probably have lingering definitions. Try using Clear[int] and then run the code again.
      $endgroup$
      – Carl Woll
      4 hours ago
















    $begingroup$
    You change the order of the integration in the above. This is not a simple matter for improper integrals. Next, in the integral presentation of DiracDelta the principal value is taken.
    $endgroup$
    – user64494
    5 hours ago





    $begingroup$
    You change the order of the integration in the above. This is not a simple matter for improper integrals. Next, in the integral presentation of DiracDelta the principal value is taken.
    $endgroup$
    – user64494
    5 hours ago













    $begingroup$
    @user64494 What makes you say g[u] is complex valued? I don't think it is. As for order of integration, I haven't been rigorous in proving that it is possible to do so, but the results seem correct, and that is sufficient for me.
    $endgroup$
    – Carl Woll
    5 hours ago




    $begingroup$
    @user64494 What makes you say g[u] is complex valued? I don't think it is. As for order of integration, I haven't been rigorous in proving that it is possible to do so, but the results seem correct, and that is sufficient for me.
    $endgroup$
    – Carl Woll
    5 hours ago












    $begingroup$
    You are right concerning g[u]. However, other remarks of me remain open. The statement "the results seem correct" is not based.
    $endgroup$
    – user64494
    4 hours ago




    $begingroup$
    You are right concerning g[u]. However, other remarks of me remain open. The statement "the results seem correct" is not based.
    $endgroup$
    – user64494
    4 hours ago












    $begingroup$
    Also int[40, WorkingPrecision -> 20] performs a lot of errors and (1/(2 [Pi]))NIntegrate[ Cos[u] g[u]^(40 + 1), u, -[Infinity], [Infinity], WorkingPrecision -> 20, Method -> "GlobalAdaptive", Method -> "GaussKronrodRule"] in version11.3. PS. The same issue in version 12.0.
    $endgroup$
    – user64494
    4 hours ago





    $begingroup$
    Also int[40, WorkingPrecision -> 20] performs a lot of errors and (1/(2 [Pi]))NIntegrate[ Cos[u] g[u]^(40 + 1), u, -[Infinity], [Infinity], WorkingPrecision -> 20, Method -> "GlobalAdaptive", Method -> "GaussKronrodRule"] in version11.3. PS. The same issue in version 12.0.
    $endgroup$
    – user64494
    4 hours ago













    $begingroup$
    @user64494 You probably have lingering definitions. Try using Clear[int] and then run the code again.
    $endgroup$
    – Carl Woll
    4 hours ago





    $begingroup$
    @user64494 You probably have lingering definitions. Try using Clear[int] and then run the code again.
    $endgroup$
    – Carl Woll
    4 hours ago














    0












    $begingroup$

    We can increase n, reducing the accuracy of calculations, for example



    f[m_, p_] := 
    Block[n = m, $MinPrecision = p, $MaxPrecision = p,
    intVars =
    Table[Subscript[t, i], -[Infinity], [Infinity], i, 1, n];
    poly = Sum[
    Subscript[t, i]^4, i, 1,
    n] + (1 - Sum[Subscript[t, i], i, 1, n])^4;
    NIntegrate[E^-poly, ##, PrecisionGoal -> p/2,
    AccuracyGoal -> p/2] & @@ intVars]
    f[4, 6]

    (* 4.47148*)

    f[5, 4]

    (* 7.75615*)

    f[6, 2]

    (* 15.8289*)





    share|improve this answer









    $endgroup$

















      0












      $begingroup$

      We can increase n, reducing the accuracy of calculations, for example



      f[m_, p_] := 
      Block[n = m, $MinPrecision = p, $MaxPrecision = p,
      intVars =
      Table[Subscript[t, i], -[Infinity], [Infinity], i, 1, n];
      poly = Sum[
      Subscript[t, i]^4, i, 1,
      n] + (1 - Sum[Subscript[t, i], i, 1, n])^4;
      NIntegrate[E^-poly, ##, PrecisionGoal -> p/2,
      AccuracyGoal -> p/2] & @@ intVars]
      f[4, 6]

      (* 4.47148*)

      f[5, 4]

      (* 7.75615*)

      f[6, 2]

      (* 15.8289*)





      share|improve this answer









      $endgroup$















        0












        0








        0





        $begingroup$

        We can increase n, reducing the accuracy of calculations, for example



        f[m_, p_] := 
        Block[n = m, $MinPrecision = p, $MaxPrecision = p,
        intVars =
        Table[Subscript[t, i], -[Infinity], [Infinity], i, 1, n];
        poly = Sum[
        Subscript[t, i]^4, i, 1,
        n] + (1 - Sum[Subscript[t, i], i, 1, n])^4;
        NIntegrate[E^-poly, ##, PrecisionGoal -> p/2,
        AccuracyGoal -> p/2] & @@ intVars]
        f[4, 6]

        (* 4.47148*)

        f[5, 4]

        (* 7.75615*)

        f[6, 2]

        (* 15.8289*)





        share|improve this answer









        $endgroup$



        We can increase n, reducing the accuracy of calculations, for example



        f[m_, p_] := 
        Block[n = m, $MinPrecision = p, $MaxPrecision = p,
        intVars =
        Table[Subscript[t, i], -[Infinity], [Infinity], i, 1, n];
        poly = Sum[
        Subscript[t, i]^4, i, 1,
        n] + (1 - Sum[Subscript[t, i], i, 1, n])^4;
        NIntegrate[E^-poly, ##, PrecisionGoal -> p/2,
        AccuracyGoal -> p/2] & @@ intVars]
        f[4, 6]

        (* 4.47148*)

        f[5, 4]

        (* 7.75615*)

        f[6, 2]

        (* 15.8289*)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 7 hours ago









        Alex TrounevAlex Trounev

        10.4k1 gold badge9 silver badges25 bronze badges




        10.4k1 gold badge9 silver badges25 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f200889%2fcompute-unstable-integral-with-high-precision%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її