Your function f[En_ ] is defined strangely. All those subexpressions k, p, q, A, B, H go into the function body and Va and En remain as variables/parameters. Hence f should be defined as f[] or better f[Va_ , En_ ].
If you want to get the value of f at some point {Va0, En0} just evaluate f[Va0, En0].
I have recoded your code and changed a little:
For the function definition:
- Added Symbol c just for readability.
- Changed the Arguments of f to f[Va_ ,En_ ].
- Added Evaluate[Simplify[...]] to the function body for better performance.
For function values:
- Added a Table with some values of f. Real and imaginary parts as a
column.
For the contour plot:
- Increased PlotPoints
- Added MaxRecursion
- Omitted Epilog
- Changed PlotLegends
- Omitted AxesOrigin
- Added FrameLabel
This gives:
If[True, Block[{En, Va, Vb, c, k, p, q, A, B, H, a, b, f, tab, t},
(* Define function *)
c = 137.036;
Vb = 50000;
k = Sqrt[En^2 - c^4]/c;
p = Sqrt[(En + c^2 - Va) (En - c^2 - Va)]/c;
q = Sqrt[(En + c^2 - Vb) (En - c^2 - Vb)]/c;
A = Sqrt[(En - c^2)/(En + c^2)];
B = Sqrt[(En - c^2 - Vb)/(En + c^2 - Vb)];
H = Sqrt[(En - c^2 - Va)/(En + c^2 - Va)]; a = 0.01; b = 0.02;
f[Va_, En_] := Evaluate[Simplify[
(E^(I*q*b)/(16*A^2*B*H)*
(((A + H)^2)*((A + B)^2*E^(2*I*(k*(a - b) - p*a)) - (A - B)^2*
E^(-2*I*(k*(a - b) - p*a))) + ((A - H)^2)*((A - B)^2*
E^(-2*I*(k*(a - b) + p*a)) - (A + B)^2*
E^(2*I*(k*(a - b) + p*a))) +
2*(A^2 - B^2)*(A^2 - H^2)*(E^(2*I*p*a) - E^(-2*I*p*a))))]];
If[False, Print[f[Va, En]]];
(* Print a table with function-values *)
tab = Table[Column[Round[ReIm[f[Va, En]], 0.01], Center]
, {Va, 0, 50000, 5000}, {En, 30000, 70000, 4000}];
Print[Grid[Join[
{Prepend[Range[30000, 70000, 4000], "Va\\En:"]},
Join[Transpose[{Range[0, 50000, 5000]}], tab, 2]],
Dividers -> {{2 -> True}, {2, True}}]];
(* Show real and imaginary part of function-values *)
Print[ContourPlot[{Re[f[Va, En]], Im[f[Va, En]]}, {Va, 0,
50000}, {En, 30000, 70000},
PlotRange -> All,
PlotPoints -> {50, 40}, MaxRecursion -> 2,
FrameLabel -> {"Va", "En"}, PlotLegends -> {"Re(f)", Im["f"]},
Epilog -> {(*Black,PointSize[0.025],Point[{Va,En}]*)}]];
]];
