Skip to content

Instantly share code, notes, and snippets.

View butchi's full-sized avatar

IWABUCHI Yu(u)ki (butchi) butchi

View GitHub Profile
@butchi
butchi / file0.txt
Last active December 15, 2015 21:52
シェルピンスキーのギャスケット(Mathematicaショートフラクタルシリーズ) ref: http://qiita.com/butchi_y/items/fbf5d2b9b49c10c8f217
Graphics@Polygon[Transpose[{Re[#], Im[#]}] & /@
Nest[
Flatten[{#/2, #/2 + 1/4 + Sqrt[3]/4 I, #/2 + 1/2}, 1] &,
{{0, 1/2 + Sqrt[3]/2 I, 1}},
6
]
]
@butchi
butchi / file0.txt
Last active December 15, 2015 21:52
シェルピンスキーのカーペット(Mathematicaショートフラクタルシリーズ) ref: http://qiita.com/butchi_y/items/3b164bb8e25dad7763cc
sierpinskiCarpet[x_] := ArrayFlatten[x /. {
0 -> {
{0, 0, 0},
{0, 0, 0},
{0, 0, 0}
},
1 -> {
{1, 1, 1},
{1, 0, 1},
{1, 1, 1}
@butchi
butchi / file1.txt
Created December 16, 2015 13:06
コッホ曲線(Mathematicaショートフラクタルシリーズ) ref: http://qiita.com/butchi_y/items/0e1c015f8c3d6955c88b
generator = {0, Pi/3, -Pi/3, 0};
(function(){
var idArr=[];
var duplicateIdArr = [];
[].forEach.call(document.querySelectorAll('[id]'), function(elm){
var id = elm.getAttribute('id');
if(idArr.indexOf(id) !== -1) {
duplicateIdArr.push(id);
} else {
idArr.push(id);
}
@butchi
butchi / dragon_normal.nb
Created December 17, 2015 12:38
ドラゴン曲線(Mathematicaショートフラクタルシリーズ) ref: http://qiita.com/butchi_y/items/4aa9a15cdffa40587544
Graphics[Line[
{Re[#], Im[#]} & /@
Join[
{0},
Accumulate[(-1)^(Nest[Join[# + 1, Reverse[#] - 1] &, {0}, 11]/4)]
]
]]
@butchi
butchi / file0.txt
Last active December 23, 2015 13:11
ツインドラゴン(Mathematicaショートフラクタルシリーズ) ref: http://qiita.com/butchi_y/items/6a32ee40c9674d8cb8c6
Graphics[Point[
Transpose[{Re[#], Im[#]} &[
Table[FromDigits[IntegerDigits[k, 2], 1 + I], {k, 0, 1023}]
]]
]]
@butchi
butchi / circle.svg
Last active November 18, 2016 03:02
SVGの作図問題とコードゴルフ ref: http://qiita.com/butchi_y/items/44b35e659bbeeb452d21
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@butchi
butchi / fibonacci_word_fractal.nb
Last active December 20, 2015 13:33
フィボナッチ列フラクタル(Mathematicaショートフラクタルシリーズ) ref: http://qiita.com/butchi_y/items/fe0fa7d3e7909ec00210
w = Flatten[Nest[{#, #[[1]]} &, {1, 0}, 20]];
ListPlot[{Re[#], Im[#]} & /@
Accumulate[
Join[
{0},
I^Accumulate[Join[{1}, w*(-1)^Mod[Range[Length[w]], 2]]]
]
],
Joined -> True,
AspectRatio -> Automatic
@butchi
butchi / file1.txt
Last active December 22, 2015 05:40
IDが重複してもページ内ジャンプできるようにする方法 ref: http://qiita.com/butchi_y/items/9a1aa858a6eb64b2ee5e
$('.env-2#p')
@butchi
butchi / dashed_grid.js
Created December 22, 2015 15:30
JavaScript本に書いてあった簡単な図形描画をMathematicaで ref: http://qiita.com/butchi_y/items/0c8a1ef9508531569ccf
var res = '\n', i, j;
for(i = 1; i <= 7; i++) {
for(j = 1; j < 15; j++) {
res += (i * j) % 8 ? ' ' : '*';
}
res+= '\n';
}