This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # most of the code is by Rainer Engelken | |
| # updated to Julia 1.0 syntax, tested on 1.4 | |
| using Luxor, StaticArrays | |
| # poincare section of chaotic network of three neurons | |
| function spikingnet(n, couplingstrength=1.0) | |
| # number of spikes in calculation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MacBook-Pro ~ $ julia | |
| _ | |
| _ _ _(_)_ | A fresh approach to technical computing | |
| (_) | (_) (_) | Documentation: https://docs.julialang.org | |
| _ _ _| |_ __ _ | Type "?help" for help. | |
| | | | | | | |/ _` | | | |
| | | |_| | | | (_| | | Version 0.6.0-rc1.0 (2017-05-07 00:00 UTC) | |
| _/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release | |
| |__/ | x86_64-apple-darwin13.4.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Luxor | |
| function array2dtogrid(a2d::AbstractArray) | |
| g = Tiler(200, 200, size(a2d)[1:2]..., margin=25) | |
| for (pos, n) in g | |
| setgray(a2d[n]) | |
| box(pos, g.tilewidth, g.tileheight, :fill) | |
| setgray(1-a2d[n]) | |
| text(string(round(a2d[n], 2)), pos, halign=:center) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env julia | |
| using Luxor | |
| function makerandomepitrochoid(n) | |
| hlist = [] | |
| plist = [] | |
| for i in 1:n | |
| R = 20 | |
| r = rand(30:3:91) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env julia | |
| using Luxor, Colors | |
| "make a color more white" | |
| function whiten(col::Color, f=0.5) | |
| hsl = convert(HSL, col) | |
| h, s, l = hsl.h, hsl.s, hsl.l | |
| return convert(RGB, HSL(h, f, f)) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env julia | |
| # inspired by http://stackoverflow.com/questions/40031913/simulate-a-bouncing-ball | |
| # and the inspired Chris Rackauckas | |
| using DifferentialEquations, ParameterizedFunctions, NLsolve, Luxor | |
| f = @ode_def BallBounce begin | |
| dy = v | |
| dv = -g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Luxor | |
| function drawcell(centerpos, width, height, colornumber; hollow=false) | |
| darker_purple = (0.584, 0.345, 0.698) | |
| lighter_purple = (0.667, 0.475, 0.757) | |
| darker_green = (0.22, 0.596, 0.149) | |
| lighter_green = (0.376, 0.678, 0.318) | |
| darker_red = (0.796, 0.235, 0.2) | |
| lighter_red = (0.835, 0.388, 0.361) | |
| color_sequence = [(darker_red, lighter_red), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Luxor | |
| function three_circles(cpos::Point, circle_radius; outercircleratio=0.75, innercircleratio=0.65) | |
| fontface("Georgia-Bold") | |
| fontsize(26) | |
| # clockwise, from bottom LEFT... | |
| points3 = ngon(cpos, circle_radius, 3, pi/6, vertices=true) | |
| for (n, p) in enumerate(points3) | |
| sethue(color_sequence[n][1]...) | |
| circle(p, outercircleratio * circle_radius, :fill) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env julia | |
| using Luxor | |
| function pidigits(n) | |
| result = Int[] | |
| k, a::BigInt, b::BigInt, a1::BigInt, b1::BigInt = 2, 4, 1, 12, 4 | |
| while n > 0 | |
| p, q, k = k * k, 2k + 1, k + 1 | |
| a, b, a1, b1 = a1, b1, p * a + q * a1, p * b + q * b1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env julia | |
| using Luxor | |
| Drawing(500, 500, "/tmp/julia-flowers.png") | |
| background("white") | |
| function juliaflowers(cpos::Point, radius; petals=30, outercircleratio=0.75, innercircleratio=0.65) | |
| # clockwise, from bottom LEFT... | |
| points3 = ngon(cpos, radius, 3, pi/6, vertices=true) |