Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. # Pkg.add("Decimals") # Not needed because this is on juliabox
  2.  
  3. using Decimals
  4.  
  5. # Defining Variables
  6. a = Decimal(0.15)
  7. b = Decimal(0.2)
  8. c = Decimal(1)
  9. d = Decimal(-2)
  10. n = Decimal(-0.5)
  11. t = 0
  12. values = []
  13. column = Dict()
  14.  
  15. # Creating the first column
  16. while n < Decimal(0.5)
  17. column[n] = a + b*n^1 + c*n^2 + d*n^3
  18. n = n + Decimal(0.02)
  19. end
  20.  
  21. # Add the first column to the array of values
  22. push!(next, column)
  23.  
  24. # Starting an infinite loop
  25. while true
  26. n = Decimal(-0.5)
  27. column = Dict()
  28.  
  29. # Creating the n'th column
  30. while n < Decimal(0.5)
  31. lastIndex = n-Decimal(0.02)
  32. nextIndex = n+Decimal(0.02)
  33. column[n] = values[end][n] + (values[end][lastIndex]*phi - 2*values[end][n]*phi + values[end][nextIndex]*phi)
  34.  
  35. if values[end][n] == values[end][lastIndex]
  36. break
  37. end
  38.  
  39. n = nextIndex
  40. end
  41.  
  42. if values[end][n] == values[end][n-Decimal(0.02)]
  43. break
  44. end
  45.  
  46. push!(values, column)
  47. t = t + 4
  48. end
  49.  
  50. println(done!)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement