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
| # draw pi digits up to Feynman point to give illusion of rounding at 999999 | |
| 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
| using Luxor, Colors, Combinatorics, Random | |
| mutable struct Ball | |
| id::Int | |
| position::Point | |
| velocity::Point | |
| color::Union{NTuple, Colorant, String} | |
| ballradius::Float64 | |
| 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
| using Luxor | |
| function frame(scene, framenumber) | |
| background("grey5") | |
| setline(1.2) | |
| eased = scene.easingfunction(framenumber-scene.framerange.start, 0, 1, scene.framerange.stop-scene.framerange.start) | |
| eased_n = sin(rescale(eased, (0, 1), (0, 2pi))) | |
| theta = eased_n/2 | |
| s = rescale(eased, 0, 1, 0.95, .01) | |
| t = rescale(eased, 0, 1, .01, 0.95) |
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 | |
| pentagon(pos, radius, ang=0, action=:stroke) = ngon(pos, radius, 5, ang, vertices=true) | |
| function drawmonth(year, month, radius) | |
| # origin is now in center of pentagon | |
| @layer begin | |
| rotate(pi) | |
| fontsize(18) | |
| fontface("DINNextLTPro-Black") |
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 | |
| darker_blue = (0.251, 0.388, 0.847) | |
| darker_purple = (0.584, 0.345, 0.698) | |
| darker_green = (0.22, 0.596, 0.149) | |
| darker_red = (0.796, 0.235, 0.2) | |
| @png begin | |
| w = 256 | |
| background("white") | |
| origin() |
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, DynamicalSystems, Colors | |
| function frame(scene, framenumber, datas) | |
| background("black") | |
| # datas contains two datasets | |
| # each dataset is an array of sarrays of 4 floats | |
| d1, d2 = datas | |
| offset = π / 2 | |
| L = 200 | |
| disksize = 15 |
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 | |
| using ODE # I should be using OrdinaryDiff, but that's for another day | |
| function pendulum(t, y) | |
| Y = [6 * (2 * y[3] - 3 * cos(y[1] - y[2]) * y[4])/(16 - 9 * cos(y[1] - y[2])^2); | |
| 6 * (8 * y[4] - 3 * cos(y[1] - y[2]) * y[3])/(16 - 9 * cos(y[1] - y[2])^2)] | |
| [Y[1]; | |
| Y[2]; | |
| - (Y[1] * Y[2] * sin(y[1] - y[2]) + 3 * sin(y[1]))/2; |
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, Colors, Combinatorics, Random | |
| mutable struct Ball | |
| id::Int | |
| position::Point | |
| velocity::Point | |
| color::Union{NTuple, Colorant, String} | |
| ballradius::Float64 | |
| 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
| julia> Pkg.status() | |
| 37 required packages: | |
| - AstroLib 0.1.0 | |
| - Atom 0.6.1 | |
| - BenchmarkTools 0.0.8 | |
| - Cairo 0.3.0 | |
| - ColorSchemes 1.4.0+ master | |
| - Combinatorics 0.4.1 | |
| - DataFrames 0.10.0 | |
| - Documenter 0.11.1 |
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 HTTP, JSON, Query | |
| # get data for the julia channel "UC9IuUwwE2xdjQUT_LMLONoA" | |
| function getrawdata(nextpagetoken, apikey) | |
| d = HTTP.get("https://www.googleapis.com/youtube/v3/search?key=$(apikey)&channelId=UC9IuUwwE2xdjQUT_LMLONoA&pageToken=$(nextpagetoken)&part=snippet,id&order=date&maxResults=50") | |
| return d.body | |
| end | |
| jsonpages = [] # store the json pages, 50 records at a time | |
| vidlinks = [] # to hold the video titles and links |