The "smoothing" comes from a gap created by `Exclusions`. Sketch the pieces separately and combine:
Show[
Plot3D[Im@expr[z] /. z -> (x + I y), {x, -1/2, 3/2}, {y, -1/2,
0},(*Enhanced plot options*)PlotRange -> {-5, 5},
PlotPoints -> 150,(*Increased for better resolution*)
MaxRecursion ->
7,(*Higher recursion for better singularity capture*)(*Color scheme\
that emphasizes extremes*)
ColorFunction -> (ColorData["TemperatureMap"][
Rescale[#3, {10, -10}, {0, 1}]] &),
ColorFunctionScaling -> False,(*Exclusions to handle singularities*)
ExclusionsStyle -> {None,
Directive[Red, Thick]},(*Enhanced mesh for contour visualization*)
MeshFunctions -> {#3 &}, Mesh -> {Range[-3, 3, .5]},
MeshStyle -> {{Opacity[0.5], Darker[Blue]}, {Opacity[0.3], Gray}},
(*Visual styling*)
PlotStyle -> Directive[Specularity[White, 10], Opacity[0.95]],
ClippingStyle -> None, Exclusions -> {Im[Sqrt[x + I y]] == 0},
Lighting -> {{"Ambient", GrayLevel[0.3]}, {"Directional", White,
ImageScaled[{0, 0, 2}]}, {"Directional", White,
ImageScaled[{1, 1, 1}]}},(*Labels and formatting*)
PlotLabel ->
Style["Stieltjes Transform of Uniform", FontSize -> 16,
FontWeight -> Bold],
AxesLabel -> {Style["Re[z]", FontSize -> 14, Bold],
Style["Im[z]", FontSize -> 14, Bold],
Style["Im[f(z)]", FontSize -> 14, Bold]},(*View and layout*)
BoxRatios -> {1, 1, 0.6}, ViewPoint -> {-2.5, 2.5, 1.8},
ViewVertical -> {0, 0, 1},
PlotTheme -> "Detailed",(*Additional styling*)
Background -> GrayLevel[0.95], ImageSize -> Large,
AxesStyle -> Directive[Black, Thickness[0.002]], Boxed -> False,
FaceGrids -> None, BaseStyle -> {FontFamily -> "Helvetica"}],
Plot3D[Im@expr[z] /. z -> (x + I y), {x, -1/2, 3/2}, {y, 0,
1/2},(*Enhanced plot options*)PlotRange -> {-5, 5},
PlotPoints -> 150,(*Increased for better resolution*)
MaxRecursion ->
7,(*Higher recursion for better singularity capture*)(*Color scheme\
that emphasizes extremes*)
ColorFunction -> (ColorData["TemperatureMap"][
Rescale[#3, {10, -10}, {0, 1}]] &),
ColorFunctionScaling -> False,(*Exclusions to handle singularities*)
ExclusionsStyle -> {None,
Directive[Red, Thick]},(*Enhanced mesh for contour visualization*)
MeshFunctions -> {#3 &}, Mesh -> {Range[-3, 3, .5]},
MeshStyle -> {{Opacity[0.5], Darker[Blue]}, {Opacity[0.3], Gray}},
(*Visual styling*)
PlotStyle -> Directive[Specularity[White, 10], Opacity[0.95]],
ClippingStyle -> None, Exclusions -> {Im[Sqrt[x + I y]] == 0},
Lighting -> {{"Ambient", GrayLevel[0.3]}, {"Directional", White,
ImageScaled[{0, 0, 2}]}, {"Directional", White,
ImageScaled[{1, 1, 1}]}},(*Labels and formatting*)
PlotLabel ->
Style["Stieltjes Transform of Uniform", FontSize -> 16,
FontWeight -> Bold],
AxesLabel -> {Style["Re[z]", FontSize -> 14, Bold],
Style["Im[z]", FontSize -> 14, Bold],
Style["Im[f(z)]", FontSize -> 14, Bold]},(*View and layout*)
BoxRatios -> {1, 1, 0.6}, ViewPoint -> {-2.5, 2.5, 1.8},
ViewVertical -> {0, 0, 1},
PlotTheme -> "Detailed",(*Additional styling*)
Background -> GrayLevel[0.95], ImageSize -> Large,
AxesStyle -> Directive[Black, Thickness[0.002]], Boxed -> False,
FaceGrids -> None, BaseStyle -> {FontFamily -> "Helvetica"}],
ParametricPlot3D[{{x, 0,
Im@expr[z] /. z -> (x + I (-$MachineEpsilon))}, {x, 0,
Im@expr[z] /. z -> (x + I (+$MachineEpsilon))}}, {x, -1/2, 3/2},
PlotStyle -> Directive[Red, Thick]],
PlotRange -> All]
[![enter image description here][1]][1]
---
@azerbajdzan's modification of the singular locus can be implemented in the method in my comment. Since the method is a simpler approximation, I thought I'd include both:
expr[z_] =
Expectation[1/(z - x), x \[Distributed] UniformDistribution[]];
ParametricPlot3D[
{x, y^3/(1/2)^2, Im@expr[z] /. z -> (x + I y^3/(1/2)^2)},
{x, -1/2, 3/2}, {y, -1/2, 1/2},(*Enhanced plot options*)
PlotRange -> {Automatic, Automatic, {-5, 5}}
, PlotPoints -> 25
, MaxRecursion -> 4
,(*Color scheme that emphasizes extremes*)
ColorFunction -> (ColorData["TemperatureMap"][
Rescale[#3, {4, -4}, {0, 1}]] &),
ColorFunctionScaling -> False,(*Exclusions to handle singularities*)
ExclusionsStyle -> {None,
Directive[Red, Thick]},(*Enhanced mesh for contour visualization*)
MeshFunctions -> {#3 &}, Mesh -> {Range[-3, 3, .5]},
MeshStyle -> {{Opacity[0.5], Darker[Blue]}, {Opacity[0.3],
Gray}},(*Visual styling*)
PlotStyle -> Directive[Specularity[White, 10], Opacity[0.95]]
(*,ClippingStyle->None*)
, Exclusions -> {{Im[z] == 0, 0 <= Re[z] <= 1} /. z -> x + I y}
, Lighting -> {{"Ambient", GrayLevel[0.3]}, {"Directional", White,
ImageScaled[{0, 0, 2}]}, {"Directional", White,
ImageScaled[{1, 1, 1}]}},(*Labels and formatting*)
PlotLabel ->
Style["Stieltjes Transform of Uniform", FontSize -> 16,
FontWeight -> Bold],
AxesLabel -> {Style["Re[z]", FontSize -> 14, Bold],
Style["Im[z]", FontSize -> 14, Bold],
Style["Im[f(z)]", FontSize -> 14, Bold]},(*View and layout*)
BoxRatios -> {1, 1, 0.6}, ViewPoint -> {-2.5, 2.5, 1.8},
ViewVertical -> {0, 0, 1},
PlotTheme -> "Detailed",(*Additional styling*)
Background -> GrayLevel[0.95], ImageSize -> Large,
AxesStyle -> Directive[Black, Thickness[0.002]], Boxed -> False,
FaceGrids -> None, BaseStyle -> {FontFamily -> "Helvetica"}]
[![enter image description here][2]][2]
[1]: https://i.sstatic.net/LRHORb0d.png
[2]: https://i.sstatic.net/iMer4Fj8.png