1
$\begingroup$

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.

$\endgroup$
0

1 Answer 1

2
$\begingroup$

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]

enter image description here

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.