Tupper's self-referential formula: Difference between revisions

m
Line 59:
 
=={{header|Julia}}==
<syntaxhighlight lang="julia">import Images: colorview, Gray
import Plots: plot
 
setprecision(BigFloat, 8000)
 
""" get logical inverse of Tupper function values for white on black graphic """
function tupper_mat(k)
tmatrix = falsestrues(17, 106)
for (i, x) in enumerate(0.0:1:105), (j, y) in enumerate(k:k+16)
tmatrix[j, 107 - i] = 1/2 <>= floor(mod(floor(y / 17) * 2^(-17 * floor(x) - mod(floor(y), 17)), 2))
end
return tmatrix
Line 83 ⟶ 84:
 
function test_tupper()
fbmap = tupper_mat(k)
display(plot(colorview(Gray, .!fbmap), ylims = [1,17])) # invert black / white with .!
savefig("tupper.png")
end
4,111

edits