0
$\begingroup$

I have a function like this:

f[x_, ψ_, δ_] := 
 Flatten[Table[{k, 
    1 + (E^(-(x^2/(2 δ^2))) x^2 ψ)/δ^4 - (
     E^(-(x^2/(2 δ^2))) ψ)/δ^2 - (
     0.19947114020071635` Gamma[
       1 + k] ((
        Sqrt[2 π] Gamma[-(3/2) + k])/((1/(-3 + 2 k))^(3/2)
          Gamma[k]) - 
        8 Sqrt[E^(-(x^2/(2 δ^2))) ψ]
          Hypergeometric2F1[1/2, k, 3/2, (
          2 E^(-(x^2/(2 δ^2))) ψ)/(3 - 2 k)]))/(
     k Sqrt[-3 + 2 k] Gamma[-0.5` + k])}, {k, {2, 400}}]]

In this I have two constants ψ and δ. Now I need to integrate this function different values of \psi and \delta. For each ψ , the delta will vary from 1,10. So for each ψ , I need to plot output.

Now for a single value of \psi, I can write as

ψ=0.4;
p1 = 
 Table[{δ, 
   NIntegrate[f[x, ψ,δ][[2]], {x, -50, 50}]}, {δ, 1, 10, 
   0.1}]

and plot the output

In a similar way I need to plot for 6 more values of ψ and make a subplot of 6 plots.

Thanks in advance.

$\endgroup$

2 Answers 2

1
$\begingroup$
ψlist = Range[.3, .6, .3/5];
δlist[ψ_] := Range[##, (#2 - #)/10] & @@ ψ {.75, 1.25};
pts = Table[{δ, NIntegrate[f[x, ψ, δ][[2]], {x, -50, 50}]}, {ψ, ψlist}, {δ, δlist[ψ]}];

ListLinePlot[pts, PlotLegends -> ("ψ = " <> ToString[#] & /@ ψlist),
 AxesLabel -> {δ, TraditionalForm @ HoldForm @ Integrate[f[x, ψ, δ][[2]], {x, -50, 50}]}]

enter image description here

$\endgroup$
0
$\begingroup$

Something like this?

p1[ψ_] := 
  Table[{δ, 
    NIntegrate[f[x, ψ, δ][[2]], {x, -50, 50}]}, {δ,
     1, 10, 0.1}];

Table[ListPlot[p1[ψ]], {ψ, {1, 2, 3, 4, 5, 6}}]
$\endgroup$
3
  • $\begingroup$ Thats ok sir, But for each [Psi] I have different set [Delta]. $\endgroup$ Commented Feb 23, 2018 at 6:21
  • $\begingroup$ @HariKrishnan How is that possible? Both Psi and Delta are independent of each other. $\endgroup$
    – zhk
    Commented Feb 23, 2018 at 6:22
  • $\begingroup$ Sir, As I have mentioned in the code. I have a function f, which is dependent on both ψ and δ. Now I need to see the behavior of the function for various δ for a fixed ψ. I also have a relation that connects both ψ and δ (not mentioned here). That relation says that for a fixed ψ there is an admissible range of δ such that the function remains stable. This range of admissible δ will vary for different ψ. Here, I would like to make a plot with 6 subplot. Each subplot will show the behavior of the function for various δ and fixed ψ. As we change ψ, we have to change the range of δ also. $\endgroup$ Commented Feb 26, 2018 at 5:28

Your Answer

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

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