# Making a density plot for an expression

I have defined a function the energy $$E$$ of a given system by

f1[A_,α_,γ_,κ_,V0_,σ_,Rc_,k_]:=(π*A^2)/(2*k)+(π*γ*σ^2)/α (A^2+PolyLog[2,-A^2α]/α)+((π^2)*(σ^4)*κ*(A^4)*V0 )/2+(Sqrt[2π]*π^2*σ^5*κ*A^4*V0)/(4Rc) Exp[σ^2/(2Rc)](-1+Erf[σ/(Sqrt*Rc)])


After fixing the values of $$A,\alpha,V0,Rc$$ and $$k$$, I want to find the values of $$\sigma$$ that makes $$E$$ minimum while varying $$\gamma$$ and $$\kappa$$. Finally, I would like to make a density plot of the results obtained.

The question is, how can this be done?

In my attempts to solve the problem, I fixed some values for the variables aforementioned. Next, I created a Table under the name mf, which stores the $$f[\gamma,\kappa,\sigma]$$ for $$\gamma$$ and $$\kappa$$ varying from $$(-100,0)$$ and $$(0,100)$$, respectively.

mf=Table[f1[1,1,γ,κ,0.003,σ,10^-6,1],{γ,-100,0,1},{κ,0,100,1}]


In what follows, I was thinking of minimizing each of the elements of mf with respect to $$\sigma$$ and finally, make the plot. I even tried to implement it but it didn't work out. I am probably making mistakes.

• You can see what's happening with E by using DensityPlot3D[f1[1,1,γ,κ,0.003,σ,10^-6,1], {\[Gamma], -100, 0}, {\[Kappa], 0, 100}, {\[Sigma], 0, 10}, AxesLabel -> Automatic, PlotLegends -> Automatic]. – Alx Oct 25 at 4:31
• To find minimum you can define appropriate function f[\[Gamma]_?NumericQ, \[Kappa]_?NumericQ] := Module[{m = NMinimize[f1[1, 1, \[Gamma], \[Kappa], 0.003, \[Sigma], 10^-6, 1], \[Sigma]]}, {\[Gamma], \[Kappa], \[Sigma] /. Last[m], First@m}]. Then make a table Quiet@Table[f[\[Gamma], \[Kappa]], {\[Gamma], -100, 0, 10}, {\[Kappa], 0, 100, 10}]; and ListDensityPlot3D[Select[Flatten[%, 1], #[[-1]] > -5000 &], PlotLegends -> Automatic]. – Alx Oct 25 at 4:35