Guest User

Untitled

a guest
Sep 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. (defun conversion (dim)
  2. (let* ((m (/ (fourth dim) (first (fifth dim)) (third dim)))
  3. (x1 (* m (- (* (fourth dim) (first dim)) (first (fifth dim)))))
  4. (y1 (* m (- (/ (first (fifth dim)) (third dim)) (* 2 (second dim))))))
  5. (list x1 y1)))
  6.  
  7. (defun fn (coords)
  8. (list (- (expt (first coords) 2)
  9. (+ (expt (second coords) 2) (third coords)))
  10. (+ (* 2 (first coords) (second coords)
  11. (third coords)))))
  12.  
  13. (defun draw (coords)
  14. (print coords))
  15.  
  16. (defun abslt (coords)
  17. (+ (expt (first coords) 2)
  18. (expt (second coords) 2)))
  19.  
  20. (defun julia ()
  21. (let* ((R 1.0) ;; radius
  22. (mult 1.0) ;; multiplier
  23. (i 0)
  24. (iterations 100)
  25. (x (* mult (random 1.0)))
  26. (y (* mult (random 1.0)))
  27. (dim (list 100 100 100))
  28. (z (conversion (list x y mult R dim))))
  29.  
  30. (loop while (and (< i iterations) (abslt z)
  31. (fn (list (first z) (second z) (third dim)))
  32.  
  33. (if (> (abslt z) R)
  34. (return))
  35. (incf i)))
  36. (if (> i -1)
  37. (draw (list x y (/ i iterations))))
  38. (julia)))
  39.  
  40. (julia)
Add Comment
Please, Sign In to add comment