# How to plot a function for various values of 2 constants

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, ψ,δ][], {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.

## 2 Answers

Something like this?

p1[\[Psi]_] :=
Table[{\[Delta],
NIntegrate[f[x, \[Psi], \[Delta]][], {x, -50, 50}]}, {\[Delta],
1, 10, 0.1}];

Table[ListPlot[p1[\[Psi]]], {\[Psi], {1, 2, 3, 4, 5, 6}}]

• Thats ok sir, But for each [Psi] I have different set [Delta]. – Hari Krishnan Feb 23 '18 at 6:21
• @HariKrishnan How is that possible? Both Psi and Delta are independent of each other. – zhk Feb 23 '18 at 6:22
• 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. – Hari Krishnan Feb 26 '18 at 5:28
ψlist = Range[.3, .6, .3/5];
δlist[ψ_] := Range[##, (#2 - #)/10] & @@ ψ {.75, 1.25};
pts = Table[{δ, NIntegrate[f[x, ψ, δ][], {x, -50, 50}]}, {ψ, ψlist}, {δ, δlist[ψ]}];

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