Guest User

Untitled

a guest
Mar 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. h1 = function(x) {
  2. log(abs(x))
  3. }
  4.  
  5. h2 = function(x) {
  6. sign(x)*log(abs(x))
  7. }
  8.  
  9. h3 = function(x) {
  10. -sign(x)*log(abs(1-2*x))
  11. }
  12.  
  13. N = 1000000
  14. x = runif(N, -10, 10)
  15. # x = rnorm(N, -8, 9)
  16. for(i in 1:200) {
  17. print(i)
  18. x = h3(x)
  19. if(i %% 50 == 0) {
  20. hist(x, breaks = 500, main = i, probability = TRUE, xlim = c(-10,10))
  21. }
  22. }
Add Comment
Please, Sign In to add comment