0
$\begingroup$

I have tried to Normalize the below Code PDF with a such Constant K But I didn't succeed , I have used this instruction: mv\[ScriptCapitalD]=ProbabilityDistribution[f[x,\[Mu]], {x, 0, \[Infinity]},Method->"Normalize"] , But no result .

MY cODE for PDF Here:(The integrand over sigma is about 0.99..), Any help ?

 f[z_?NumericQ, \[Mu]_?NumericQ] := 
      NIntegrate[
   K* Sqrt[Sqrt [ 2]*Pi]/2*Exp[-Sqrt[Sqrt[2]*Pi](z+\[Sigma])^2/\[Mu]*Sqrt[Pi*\[Sigma]]
    * Erf[\[Mu](z-\[Sigma])^2/(Sqrt[Pi*\[Sigma]])]], {\[Sigma],1, \[Infinity]}]
    pdfF[\[Mu]_?NumericQ] := PDF[ProbabilityDistribution[f[x,\[Mu] ], {x, 0, \[Infinity]}]]
    With[{n = 5},
      Show[
          Plot[
            Labeled[pdfF[#1][z], Row[{"\[Mu] = ", Rationalize[#1]}], Above], {z, 0, 5},
            PlotRange -> All,
            PlotStyle -> #2] &
        @@@
          Rest[{#, Hue[#]} & /@ Subdivide[0., 1., n]],
      ImageSize -> Large]]
    With[{n = 5}, NIntegrate[pdfF[#][z], {z, 0, 5}] & /@ (Range[n]/n)]

    Plot[Evaluate[f[z_?NumericQ, \[Mu]_?NumericQ] ], {x, 0, 10},{\[Mu],0,1}, AxesOrigin \[RightArrow] {0, 0},
    Epilog \[RightArrow] {Dashed, Line[{{0, f[z_?NumericQ, \[Mu]_?NumericQ]}, {10, f[z_?NumericQ, \[Mu]_?NumericQ]}}]}, PlotRange \[RightArrow] {{0, 10}, {0, 1}}] 

This is the plot that i have got for n=5 enter image description here

$\endgroup$
  • $\begingroup$ Please define K and trim the unnecessary code. Why does z only go from 0 to 5? Just executing Plot[f[x, 4], {x, 0, 20}] (with K=1) shows some oddities. $\endgroup$ – JimB Dec 26 '19 at 20:33
  • $\begingroup$ @JimB ,This is what I have used for normalization but it doesn't work:mv[ScriptCapitalD] = ProbabilityDistribution[ kSqrt[10Sqrt [ 2]*Pi]/(2*Pi)*Exp[-PiSqrt[2*[Sigma]](z+[Sigma])^2 * Erf[[Mu](z-[Sigma])^2/Sqrt[Sqrt[2]*Pi*[Sigma]] ]/[Mu],{[Sigma], 1,Infinity}], {z, 0,5},{[Mu], 0,1} ,{k,1,Infinity}, Method -> "Normalize"] $\endgroup$ – zeraoulia rafik Dec 26 '19 at 22:19
  • $\begingroup$ I think the issue is with the limits used for NIntegrate. Using 1 through $\infty$ doesn't allow Nintegrate to work well. I'll add an example as an extended comment. $\endgroup$ – JimB Dec 26 '19 at 22:26
  • $\begingroup$ This is my PDF formula :$$\int_1^{\infty } \frac{\sqrt{10 \sqrt{2} \pi } \exp \left(-\frac{\pi \sqrt{2 \sigma } (z+\sigma )^2 \text{erf}\left(\frac{\mu (z-\sigma )^2}{\sqrt{\sqrt{2} \pi \sigma }}\right)}{\mu }\right)}{0.997266 \times2 \pi } \, d\sigma$$ $\endgroup$ – zeraoulia rafik Dec 26 '19 at 22:36
1
$\begingroup$

This is an extended comment.

I think the issue is that using {σ, 1, ∞} for the limits of integration doesn't allow NIntegrate to work well. (Yes, those are what the limits should be.) Here's an example.

integrand[z_, μ_, σ_] := Sqrt[Sqrt[2]*Pi]/2*
  Exp[-Sqrt[Sqrt[2]*Pi] (z + σ)^2/μ*Sqrt[Pi*σ]*Erf[μ (z - σ)^2/(Sqrt[Pi*σ])]]

Plot[integrand[4.75, 4, σ], {σ, 1, 6}, PlotRange -> All]

Integrand over sigma

Now if we integrate over two different limits of integration:

NIntegrate[integrand[4.75, 4, σ], {σ, 1, ∞}]
(* 1.5504*10^-15 )*

NIntegrate[integrand[4.75, 4, σ], {σ, 4.5, 5.1}]
(* 0.127522 *)

The latter result makes more sense. So when determining K one will need to adjust the limits of integration for different values of z and μ. However, I don't have an idea as to automate that process with reasonable limits of integration.

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Do you meant that can't be a PDF over the range of sigma ? , I have did the same Idea , the integral dosn't work as well for example in the Range (10,25) $\endgroup$ – zeraoulia rafik Dec 26 '19 at 22:41
  • 1
    $\begingroup$ No. I'm just saying that one needs to be careful with assigning limits of integration with this function. Just using {\[sigma],1,Infinity} many times misses where the integrand is most positive and one ends up with an erroneous value of near zero. It might very well be that the integral over $z$ (not $\sigma$) is infinite. But you need to fix the issue with NIntegrate first. $\endgroup$ – JimB Dec 26 '19 at 22:44
  • $\begingroup$ The value of Mu are in (0,1) $\endgroup$ – zeraoulia rafik Dec 27 '19 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.