Skip to main content
Notice removed Authoritative reference needed by CommunityBot
Bounty Ended with no winning answer by CommunityBot
deleted 143 characters in body
Source Link
march
  • 24.2k
  • 2
  • 46
  • 102

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
\[Beta]0β0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := 
  Hypergeometric1F1[l + 1 - \[Beta]0β0, 2 l + 2, (
    2 Z r)/\[Beta]0]β0] Exp[(-2 Z r)/(2 \[Beta]0β0)] ( (2 Z r)/\[Beta]0β0)^
   l;^l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[
    r^2NIntegrate[r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Norm[Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, \[Theta]p_θp_?NumericQ] := (3 Cos[\[Theta]p]^2Cos[θp]^2)/(4 \[Pi]π)
    Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[
    fp[pNIntegrate[fp[p, \[Theta]]θ] Log[fp[p, \[Theta]]]θ]] p^2 Sin[\[Theta]]Sin[θ], {p, 0, 
     10}, {\[Theta]θ, 0, Pi}] // AbsoluteTiming

{1155.65, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{234.691, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
\[Beta]0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := 
  Hypergeometric1F1[l + 1 - \[Beta]0, 2 l + 2, (
    2 Z r)/\[Beta]0] Exp[(-2 Z r)/(2 \[Beta]0)] ( (2 Z r)/\[Beta]0)^
   l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[
    r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Norm[Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, \[Theta]p_?NumericQ] := (3 Cos[\[Theta]p]^2)/(4 \[Pi])
    Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[
    fp[p, \[Theta]] Log[fp[p, \[Theta]]] p^2 Sin[\[Theta]], {p, 0, 
     10}, {\[Theta], 0, Pi}] // AbsoluteTiming

{1155.65, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{234.691, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
β0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := Hypergeometric1F1[l + 1 - β0, 2 l + 2, (2 Z r)/β0] Exp[(-2 Z r)/(2 β0)] ( (2 Z r)/β0)^l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Norm[Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, θp_?NumericQ] := (3 Cos[θp]^2)/(4 π) Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[fp[p, θ] Log[fp[p, θ]] p^2 Sin[θ], {p, 0, 10}, {θ, 0, Pi}] // AbsoluteTiming

{1155.65, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{234.691, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

Notice added Authoritative reference needed by Vancheers
Bounty Started worth 50 reputation by Vancheers
edited body
Source Link
Vancheers
  • 776
  • 3
  • 15

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
\[Beta]0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := 
  Hypergeometric1F1[l + 1 - \[Beta]0, 2 l + 2, (
    2 Z r)/\[Beta]0] Exp[(-2 Z r)/(2 \[Beta]0)] ( (2 Z r)/\[Beta]0)^
   l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[
    r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Norm[Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, \[Theta]p_?NumericQ] := (3 Cos[\[Theta]p]^2)/(4 \[Pi])
    Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[
    fp[p, \[Theta]] Log[fp[p, \[Theta]]] p^2 Sin[\[Theta]], {p, 0, 
     10}, {\[Theta], 0, Pi}] // AbsoluteTiming

{12171155.6765, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{278234.318691, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
\[Beta]0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := 
  Hypergeometric1F1[l + 1 - \[Beta]0, 2 l + 2, (
    2 Z r)/\[Beta]0] Exp[(-2 Z r)/(2 \[Beta]0)] ( (2 Z r)/\[Beta]0)^
   l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[
    r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Norm[Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, \[Theta]p_?NumericQ] := (3 Cos[\[Theta]p]^2)/(4 \[Pi])
    Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[
    fp[p, \[Theta]] Log[fp[p, \[Theta]]] p^2 Sin[\[Theta]], {p, 0, 
     10}, {\[Theta], 0, Pi}] // AbsoluteTiming

{1217.67, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{278.318, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
\[Beta]0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := 
  Hypergeometric1F1[l + 1 - \[Beta]0, 2 l + 2, (
    2 Z r)/\[Beta]0] Exp[(-2 Z r)/(2 \[Beta]0)] ( (2 Z r)/\[Beta]0)^
   l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[
    r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Norm[Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, \[Theta]p_?NumericQ] := (3 Cos[\[Theta]p]^2)/(4 \[Pi])
    Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[
    fp[p, \[Theta]] Log[fp[p, \[Theta]]] p^2 Sin[\[Theta]], {p, 0, 
     10}, {\[Theta], 0, Pi}] // AbsoluteTiming

{1155.65, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{234.691, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

added 6 characters in body
Source Link
Vancheers
  • 776
  • 3
  • 15

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
\[Beta]0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := 
  Hypergeometric1F1[l + 1 - \[Beta]0, 2 l + 2, (
    2 Z r)/\[Beta]0] Exp[(-2 Z r)/(2 \[Beta]0)] ( (2 Z r)/\[Beta]0)^
   l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[
    r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Sqrt[NIntegrate[Norm[Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]];]]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, \[Theta]p_?NumericQ] := (3 Cos[\[Theta]p]^2)/(4 \[Pi])
    Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[
    fp[p, \[Theta]] Log[fp[p, \[Theta]]] p^2 Sin[\[Theta]], {p, 0, 
     10}, {\[Theta], 0, Pi}] // AbsoluteTiming

{1217.67, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{278.318, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
\[Beta]0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := 
  Hypergeometric1F1[l + 1 - \[Beta]0, 2 l + 2, (
    2 Z r)/\[Beta]0] Exp[(-2 Z r)/(2 \[Beta]0)] ( (2 Z r)/\[Beta]0)^
   l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[
    r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, \[Theta]p_?NumericQ] := (3 Cos[\[Theta]p]^2)/(4 \[Pi])
    Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[
    fp[p, \[Theta]] Log[fp[p, \[Theta]]] p^2 Sin[\[Theta]], {p, 0, 
     10}, {\[Theta], 0, Pi}] // AbsoluteTiming

{1217.67, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{278.318, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

The parameters and functions are loaded as follows:

Clear["Global`*"]
epslon = 8.9;
Z = 1.0/epslon; l = 1.0; R0 = 2;
EE = 2.419601;
\[Beta]0 = Sqrt[-Z^2/(2*EE)];
Rnl[r_] := 
  Hypergeometric1F1[l + 1 - \[Beta]0, 2 l + 2, (
    2 Z r)/\[Beta]0] Exp[(-2 Z r)/(2 \[Beta]0)] ( (2 Z r)/\[Beta]0)^
   l;
Rnlh[p_?NumericQ] := -Sqrt[(2/Pi)] NIntegrate[
    r^2 Rnl[r] (Sin[p r]/(p r)^2 - Cos[p r]/(p r)), {r, 0, R0}];
normp = Norm[Sqrt[NIntegrate[(Rnlh[p]^2) p^2, {p, 0, Infinity}]]];
Rnlend[p_?NumericQ] := Rnlh[p]/normp;
fp[p_?NumericQ, \[Theta]p_?NumericQ] := (3 Cos[\[Theta]p]^2)/(4 \[Pi])
    Norm[Rnlend[p]]^2;

What I want to calculate is: $S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta$

Because the range of p is 0 to infinity when calculating S, no result can be obtained after the calculation for a long time. I give the range of p as 0-10 for preliminary test.

Method 1:

S1 = -2 Pi  NIntegrate[
    fp[p, \[Theta]] Log[fp[p, \[Theta]]] p^2 Sin[\[Theta]], {p, 0, 
     10}, {\[Theta], 0, Pi}] // AbsoluteTiming

{1217.67, 4.42307}

Method 2: the idea of changing variables

$$ fp=\frac{3}{4\pi}\cos ^2\theta \cdot \left| \text{R}nlend \right|^2 $$ $$ S=-2\pi \int_0^{\infty}{\int_0^{\pi}{fp\cdot \ln \left( fp \right) \cdot p^2}}\sin \theta dpd\theta $$ $$ Let\ \cos \theta =y $$ $$ S2=S=-2\pi \int_0^{\infty}{\int_{-1}^1{\frac{3y^2}{4\pi}}}\left| Rnlend \right|^2\ln \left( \frac{3}{4\pi}y^2\left| Rnlend \right|^2 \right) p^2dpdy $$

S2 = -2 Pi  NIntegrate[(3 y^2)/(4 Pi)
      Norm[Rnlend[p]]^2 Log[3/(4 Pi) y^2 Norm[Rnlend[p]]^2] p^2, {p, 
     0, 10}, {y, -1, 1}] // AbsoluteTiming

{278.318, 4.42307}

To sum up, we can find that the speed of Method 2 is much faster than that of Method 1, but it is still unable to solve the solution when the p range is 0 to infinity. So ask if there is a better solution.

Source Link
Vancheers
  • 776
  • 3
  • 15
Loading