Sunday, August 21, 2016

Tiling using Rounded Crosses















( Mathematical software used: Graph )


Related posts:

Wednesday, August 17, 2016

Rounded Cross - cross with rounded corners (圓角十字形)



gnuplot script:

a = 2
b = 1
c = 1
w = 8
max(x,y) = x < y ? y : x
min(x,y) = x < y ? x : y
fun(x,y) = \
  min(min(max(abs(x)-b,0)**2 + max(abs(y)-(a+b+2*c),0)**2 - c**2, \
  max(abs(x)-(a+b+2*c),0)**2 + max(abs(y)-b,0)**2 - c**2), \
  max((abs(x)-(b+c))**2 + (abs(y)-(b+c))**2 - c**2, \
  c**2 - (abs(x)-(b+2*c))**2 - (abs(y)-(b+2*c))**2))
set xrange [-w:w]
set yrange [-w:w]
set size ratio -1
set samples 512
set isosamples 512
set contour base
set cntrparam levels discrete 0.0
unset key
unset surface
set table 'fun.dat'
splot fun(x,y)
unset table
plot 'fun.dat' w l lw 1.5 lc rgb "red"

(a = 2, b = 1, c = 1)


(a = 4, b = 0.5, c = 0.5)


(a = 0, b = 0, c = 2)


(a = 0, b = 2, c = 4/3)


(a = 2, b = 0, c = 4/3)


( Mathematical softwares used: Graph, gnuplot )


Related posts:

Sunday, August 7, 2016

How to Draw the Olympic Rings Mathematically?


Inequalities (Relations) for the Olympic Rings:

  1. (Blue Ring)  min(max(R1(x,y), -y), max(R1(x,y), y, -R4(x,y))) < 0
  2. (Black Ring)  min(max(R2(x,y), -y, -R4(x,y)), max(R2(x,y), y, -R5(x,y))) < 0
  3. (Red Ring)  min(max(R3(x,y), -y, -R5(x,y)), max(R3(x,y), y)) < 0
  4. (Yellow Ring)  min(max(R4(x,y), -y, -R1(x,y)), max(R4(x,y), y, -R2(x,y))) < 0
  5. (Green Ring)  min(max(R5(x,y), -y, -R2(x,y)), max(R5(x,y), y, -R3(x,y))) < 0

Functions:
  • R1(x,y) = (sqrt((x+2d)² + (y-h)²) - a)² - b²
  • R2(x,y) = (sqrt(x² + (y-h)²) - a)² - b²
  • R3(x,y) = (sqrt((x-2d)² + (y-h)²) - a)² - b²
  • R4(x,y) = (sqrt((x+d)² + (y+h)²) - a)² - b²
  • R5(x,y) = (sqrt((x-d)² + (y+h)²) - a)² - b²

Constants:
  • a = 49.25
  • b = 4.75
  • d = 58.5
  • h = 25

Examples:


( Mathematical softwares used: Graph, gnuplot )

Tuesday, July 5, 2016

Using Trigonometry to Express the Equations of Piecewise Spirals

Circle Spirals (spirals made of semicircles):

Equations: sin(π sqrt((x + k sgn(y)/2)² + y²)) = 0
k = 1, 2, 3, ..., 8

Equations: cos(π sqrt((x + k sgn(y)/2)² + y²)) = 0
k = 1, 2, 3, ..., 8


Square Spirals (spirals made of half-squares):

Equations: sin(π(abs(x + k sgn(y)/2) + abs(y))) = 0
k = 1, 2, 3, 4

Equations: cos(π(abs(x + k sgn(y)/2) + abs(y))) = 0
k = 1, 2, 3, 4


Regular Polygon Spirals (spirals made of regular semi-polygons):

Equations: sin(π p(x + k sgn(y)/2, y)) = 0
k = 1, 2, 3, ..., 8
p(x,y) = sqrt(x² + y²) sec(π/n) cos(mod(arctan(y/x),2π/n) - π/n)
n = 6


Equations:cos(π p(x + k sgn(y)/2, y)) = 0
k = 1, 2, 3, ..., 8
p(x,y) = sqrt(x² + y²) sec(π/n) cos(mod(arctan(y/x),2π/n) - π/n)
n = 6


( Mathematical softwares used: Graph, gnuplot )

Wednesday, June 22, 2016

Folding Star Polygons using Equations (用方程式摺星形多邊形)

Regular star polygon {8/3}


Regular star polygon {12/4}


Regular star polygon {12/5}


Regular star polygon {10/4}


Regular star polygon {15/6}


( Mathematical softwares used: Graph, gnuplot )


Related posts:

Friday, June 17, 2016

Folding Stars using Equations (用方程式摺星星)














Example 1.

(n = 5, ratio = 1)

gnuplot script 1:


n = 5
ratio = 1.0
A = 2*pi/n
c = 2*cos(A)
d = ratio*c*(1 - cos(A))/(1 + cos(A))
max(x,y) = x < y ? y : x
f1(x,y) = max(max(abs(y - c) - d, y*cos(A) - x*sin(A) - c/cos(A)), \
   max(d - abs(y*cos(A) - x*sin(A) - c), y*cos(3*A) - x*sin(3*A) - c + d))
f2(x,y) = f1(y*sin(A) + x*cos(A), y*cos(A) - x*sin(A))
f3(x,y) = f1(y*sin(2*A) + x*cos(2*A), y*cos(2*A) - x*sin(2*A))
f4(x,y) = f1(y*sin(3*A) + x*cos(3*A), y*cos(3*A) - x*sin(3*A))
f5(x,y) = f1(y*sin(4*A) + x*cos(4*A), y*cos(4*A) - x*sin(4*A))
set xrange [-2.5:2.5]
set yrange [-2.5:2.5]
set size ratio -1
set samples 256
set isosamples 256
set contour base
set cntrparam levels discrete 0.0
unset key
unset surface
set table 'f1.dat'
splot f1(x,y)
unset table
set table 'f2.dat'
splot f2(x,y)
unset table
set table 'f3.dat'
splot f3(x,y)
unset table
set table 'f4.dat'
splot f4(x,y)
unset table
set table 'f5.dat'
splot f5(x,y)
unset table
plot 'f1.dat' w l lw 2 lc rgb "#0099ff", \
       'f2.dat' w l lw 2 lc rgb "#0099ff", \
       'f3.dat' w l lw 2 lc rgb "#0099ff", \
       'f4.dat' w l lw 2 lc rgb "#0099ff", \
       'f5.dat' w l lw 2 lc rgb "#0099ff"


Example 2.

(n = 6, ratio = 1)

gnuplot script 2:


n = 6
ratio = 1.0
A = 2*pi/n
c = 1
d = ratio*c/3
max(x,y) = x < y ? y : x
f1(x,y) = max(max(abs(y - c) - d, y - sqrt(3)*x - 4*c), \
   max(d - abs(y*cos(A) - x*sin(A) - c), y*cos(4*A) - x*sin(4*A) - c + d))
f2(x,y) = f1(y*sin(A) + x*cos(A), y*cos(A) - x*sin(A))
f3(x,y) = f1(y*sin(2*A) + x*cos(2*A), y*cos(2*A) - x*sin(2*A))
f4(x,y) = f1(y*sin(3*A) + x*cos(3*A), y*cos(3*A) - x*sin(3*A))
f5(x,y) = f1(y*sin(4*A) + x*cos(4*A), y*cos(4*A) - x*sin(4*A))
f6(x,y) = f1(y*sin(5*A) + x*cos(5*A), y*cos(5*A) - x*sin(5*A))
set xrange [-2.5:2.5]
set yrange [-2.5:2.5]
set size ratio -1
set samples 256
set isosamples 256
set contour base
set cntrparam levels discrete 0.0
unset key
unset surface
set table 'f1.dat'
splot f1(x,y)
unset table
set table 'f2.dat'
splot f2(x,y)
unset table
set table 'f3.dat'
splot f3(x,y)
unset table
set table 'f4.dat'
splot f4(x,y)
unset table
set table 'f5.dat'
splot f5(x,y)
unset table
set table 'f6.dat'
splot f6(x,y)
unset table
plot 'f1.dat' w l lw 2 lc rgb "#0099ff", \
       'f2.dat' w l lw 2 lc rgb "#0099ff", \
       'f3.dat' w l lw 2 lc rgb "#0099ff", \
       'f4.dat' w l lw 2 lc rgb "#0099ff", \
       'f5.dat' w l lw 2 lc rgb "#0099ff", \
       'f6.dat' w l lw 2 lc rgb "#0099ff"


Example 3.

(n = 8, ratio = 1)

Graph files:



( Mathematical softwares used: Graph, gnuplot )


Related posts:

Sunday, June 12, 2016

Momotaro Peach Boy (桃太郎)

Inequalities:
(x² + 4(y+1)²) [(x² + y² - 3)sqrt(x² + y²) - a(1 - by/sqrt(x² + y²))^ln(c + abs(x)/sqrt(x² + y²))] < d
a = 5, -1.25, -2.1, -2.2, -2.36, -2.6
b = 0.84,  c = 0.5,  d = 0.1




( Softwares used: Graph, PhotoScape )