Guest User

Untitled

a guest
Jun 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. In[1]:= NumLessThan[x_, data_] := (i = 1;
  2. For[i := 1, x > data[[i]] && i <= Length[data], i++, i]; i - 1)
  3.  
  4. In[2]:= CDFDisc[x_, data_] := NumLessThan[x, Sort[data]]/Length[data]
  5.  
  6. In[3]:= data =
  7. RandomVariate[NormalDistribution[],
  8. 2]; Plot[{CDF[NormalDistribution[], x], CDFDisc[x, data]}, {x, -5,
  9. 4}]
  10.  
  11. In[4]:= NIntegrate[
  12. Abs[CDF[NormalDistribution[], x] - CDFDisc[x, data]], {x, -10, 10}]
  13.  
  14. Out[4]= 10.
  15.  
  16. In[5]:= Plot[
  17. Abs[CDF[NormalDistribution[-0.5, 1], x] - CDFDisc[x, data]], {x, -10,
  18. 10}, PlotRange -> Full]
  19.  
  20. In[6]:= NIntegrate[CDF[NormalDistribution[], x], {x, -10, 10}]
  21.  
  22. Out[6]= 10.
Add Comment
Please, Sign In to add comment