0
$\begingroup$
  χ[b_] := (Z/k)*NIntegrate[Subscript[f, pp1][q]*Subscript[F, pp1][q]*BesselJ[0, q*b]*q, {q, 0, b}]; 

  bList = Table[b, {b, 0, 5.1 , 0.05}]

where:

     Z = 6;
     k=1.55246;
     Subscript[f, pp1][q_]=(6.254736279890945*(1 - 1.4511668475476842))/E^(0.2115*q^2)

     Subscript[F, pp1][q_] := ((4*Pi)/q)*NIntegrate[Subscript[ρ, p][r]*Sin[q*r]*r, {r, 0, Infinity}]; 

     Subscript[ρ, p][r_]=0.013132593248303927/(1 + (E^(1.7543859649122808*(-2.380427976610103 - r)) + E^(1.7543859649122808*(-2.380427976610103 + r)))*
    (0.5 + 0.08823886490842314*r^2)^1.5)
$\endgroup$
4
  • 1
    $\begingroup$ Please provide values for all the constants and definitions of the functions or we can't answer this. $\endgroup$
    – flinty
    Jul 19 '20 at 21:57
  • $\begingroup$ The definition of Subscript[f, pp1] is missing the argument and should presumably read Subscript[f, pp1][q_] and the definition contains an undefined variable i $\endgroup$
    – Bob Hanlon
    Jul 20 '20 at 4:03
  • $\begingroup$ I fix it, Please help me in the error $\endgroup$
    – user69941
    Jul 21 '20 at 2:37
  • $\begingroup$ I think to do interpolation here , because the program said ,((NIntegrate::inumr: The integrand (0.0131326 r Sin[q r])/(1+(E^(1.75439 Plus[<<2>>])+E^(1.75439 Plus[<<2>>])) (0.5 +0.0882389 Power[<<2>>])^1.5) has evaluated to non-numerical values for all sampling points in the region with boundaries {{[Infinity],0.}}. $\endgroup$
    – user69941
    Jul 21 '20 at 2:38
0
$\begingroup$
Clear["Global`*"]

Subscript[f, pp1][q_] = (6.254736279890945*(1 - 1.4511668475476842))/
   E^(0.2115*q^2);

Subscript[F, pp1][q_?NumericQ] := ((4*Pi)/q)*
   NIntegrate[Subscript[ρ, p][r]*Sin[q*r]*r, {r, 0, Infinity}];

Subscript[ρ, p][r_] = 
  0.013132593248303927/(1 + \
(E^(1.7543859649122808*(-2.380427976610103 - r)) + 
        E^(1.7543859649122808*(-2.380427976610103 + r)))*(0.5 + 
         0.08823886490842314*r^2)^1.5);

χ[b_?NumericQ] := (Z/k)*NIntegrate[
    Subscript[f, pp1][q]*Subscript[F, pp1][q]*BesselJ[0, q*b]*q, {q, 0, b}];

Z = 6; k = 1.55246;

data = {#, χ[#]} & /@ Range[0, 5.1, 0.05] // Quiet;

f = Interpolation[data];

Plot[f[b], {b, 0, 5.1}, 
 Epilog -> {Red, AbsolutePointSize[3], Point[data]}]

enter image description here

$\endgroup$
3
  • $\begingroup$ what I can do Please, I did like your answer but I am waiting the program 7 hours until now running (( f = Interpolation[data];)) $\endgroup$
    – user69941
    Jul 22 '20 at 4:03
  • $\begingroup$ @Alshammari - I just reran the code on my laptop using version 12.1.1. AbsoluteTiming for calculation of data took 59.9884 seconds and calculation of f took 0.000592 seconds. If you copied the above and executed it, the problem must be due to a version difference. $\endgroup$
    – Bob Hanlon
    Jul 22 '20 at 4:13
  • $\begingroup$ @Alshammari and @BobHanlon, since Subscript[F, pp1][q_?NumericQ] is called very often, generate an InterpolatingFunction of it, here F1, and use it with chi. Subscript[F1, pp1] = FunctionInterpolation[Subscript[F, pp1][q], {q, .01, 5.1}]; This is much faster (although problems at very small q with NIntegrate have to be solved). $\endgroup$
    – Akku14
    Dec 18 '20 at 7:47

Your Answer

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