# Ratio involving CDF and PDF of a standard normal random variable behaves unexpected when plotted

Good morning,

I am plotting the function $$h[x]$$, see below, and obtain an oscillating behavior in the range $$x \in [7.2,8.3]$$ that cannot be explained by the function itself. Also for $$x \ge 8.4$$ it seems to be a constant function which is not plausible either, and the limit for $$x \to \infty$$ should be $$-1$$ and not $$0.5$$ as visually indicated.

Here is the code:

h[x_]:=(x*CDF[NormalDistribution[0, 1], x]*Log[CDF[NormalDistribution[0, 1], x]])/PDF[NormalDistribution[0, 1], x];  Plot[h[x], {x, -7, 20}]


There seems to be a numerical issue that I cannot resolve. Do you have any idea? Thanks for your support, Aronas.

It works if you boost the Working precision.

h[x_] := (x*CDF[NormalDistribution[0, 1], x]*
Log[CDF[NormalDistribution[0, 1], x]])/
PDF[NormalDistribution[0, 1], x];


Then

Plot[h[x], {x, -5, 14}, WorkingPrecision -> 80]


Note that for a  WorkingPrecision -> 40 one gets a smooth output with a sharp discontinuity near 13.5 which is somewhat misleading.

• Thanks chris for the very fast answer!! It works here as well. Have a nice day, Aronas. Jun 30, 2021 at 7:19
• You are welcome. Please don't forget to eventually validate the answer which best address your problem . Jun 30, 2021 at 7:21