Teaching Geometry to Grade 3 kids

Teaching Geometry to Grade 3 kids

In [72]:
import matplotlib.pyplot as plt
from numpy import pi , sin , cos, linspace

Create a point at origin

In [9]:
plt.plot(0, 0)
Out[9]:
[<matplotlib.lines.Line2D at 0x7f76ea1d4bd0>]
In [10]:
plt.plot(0, 0, marker = 'o')
Out[10]:
[<matplotlib.lines.Line2D at 0x7f76ea1435d0>]

add different type of marker

In [11]:
plt.plot(0, 0, marker = '*')
Out[11]:
[<matplotlib.lines.Line2D at 0x7f76ea47ee10>]
In [12]:
plt.plot(0, 0, marker = 'o', color = 'red')
Out[12]:
[<matplotlib.lines.Line2D at 0x7f76ea196ad0>]

different color of marker

In [13]:
plt.plot(0, 0, marker = 'o', color = 'green')
Out[13]:
[<matplotlib.lines.Line2D at 0x7f76ea05b9d0>]
In [14]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 7)
Out[14]:
[<matplotlib.lines.Line2D at 0x7f76e9fca4d0>]
In [15]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 70)
Out[15]:
[<matplotlib.lines.Line2D at 0x7f76e9fa9f10>]
In [18]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('Nutan',
                  xy = (0, 0)
                  )
Out[18]:
Text(0, 0, 'Nutan')
In [22]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('Nutan',
                  xy = (0 + 1, 0)
                  )
Out[22]:
Text(1, 0, 'Nutan')
In [23]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('Nutan',
                  xy = (0 + 1, 0)
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
Out[23]:
(-2.0, 2.0)
In [25]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('Nutan',
                  xy = (0 + .1, 0 + .1)
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
Out[25]:
(-2.0, 2.0)
In [26]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('Nutan',
                      xy = (0 + .1, 0 + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
Out[26]:
(-2.0, 2.0)
In [27]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('A(0, 0)',
                      xy = (0 + .1, 0 + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
Out[27]:
(-2.0, 2.0)
In [28]:
plt.plot(0, 0, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('A(0, 0)',
                      xy = (0 + .1, 0 + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [ ]:
 
In [ ]:
 

Create variable x and y and change (0, 0) in plot

In [29]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('A(0, 0)',
                      xy = (0 + .1, 0 + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [30]:
x = 1
y = 1.5
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('A(0, 0)',
                      xy = (0 + .1, 0 + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [31]:
x = 1
y = 1.5
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate('A(0, 0)',
                      xy = (x + .1, y + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [32]:
x = 1
y = 1.5
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate(f'A({x}, {y})',
                      xy = (x + .1, y + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [33]:
x = -1
y = 1
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate(f'A({x}, {y})',
                      xy = (x + .1, y + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [34]:
x = 3
y = 4
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate(f'A({x}, {y})',
                      xy = (x + .1, y + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [36]:
x = 3
y = 4
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate(f'A({x}, {y})',
                      xy = (x + .1, y + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 4)
plt.ylim(-2, 5)
plt.show()
In [40]:
x = -2
y = -3
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate(f'A({x}, {y})',
                      xy = (x + .1, y + .1),
                      fontsize = 20
                  )

plt.xlim(-2, 4)
plt.ylim(-2, 5)
plt.show()
In [41]:
x = -2
y = -3
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate(f'A({x}, {y})',
                      xy = (x + .1, y + .1),
                      fontsize = 20
                  )

plt.xlim(-3, 4)
plt.ylim(-4, 5)
plt.show()
In [43]:
x = -2
y = -3
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

plt.gca().annotate(f'A({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

plt.xlim(-3, 4)
plt.ylim(-4, 5)
plt.show()
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 

Create more four points. These points will be on right side, left side, top and bottom from the origin.

In [45]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)
plt.gca().annotate(f'O({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

x = 1
y = 0
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
plt.gca().annotate(f'R({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

x = 0
y = 1
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)
plt.gca().annotate(f'T({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

x = 0
y = -1
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)
plt.gca().annotate(f'L({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

x = -1
y = 0
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)


#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()

Change four points to cos and sin

In [46]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)
plt.gca().annotate(f'O({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 0/4 * 2 * pi
x = 1
y = 0
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
plt.gca().annotate(f'R({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 1/4 * 2 * pi
x = 0
y = 1
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)
plt.gca().annotate(f'T({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 2/4 * 2 * pi
x = 0
y = -1
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)
plt.gca().annotate(f'L({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 3/4 * 2 * pi
x = -1
y = 0
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)


#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [47]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)
plt.gca().annotate(f'O({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 0/4 * 2 * pi
x = cos(theta)
y = sin(theta)
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
plt.gca().annotate(f'R({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 1/4 * 2 * pi
x = cos(theta)
y = sin(theta)
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)
plt.gca().annotate(f'T({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 2/4 * 2 * pi
x = cos(theta)
y = sin(theta)
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)
plt.gca().annotate(f'L({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 3/4 * 2 * pi
x = cos(theta)
y = sin(theta)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)


#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [48]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)
plt.gca().annotate(f'O({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 0/4 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
plt.gca().annotate(f'R({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 1/4 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)
plt.gca().annotate(f'T({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 2/4 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)
plt.gca().annotate(f'L({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 3/4 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)


#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [49]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)
plt.gca().annotate(f'O({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 0/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
plt.gca().annotate(f'R({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 1/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)
plt.gca().annotate(f'T({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 2/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)
plt.gca().annotate(f'L({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 3/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)


theta = 4/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 5/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 6/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 7/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [50]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)
plt.gca().annotate(f'O({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 0/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
plt.gca().annotate(f'R({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 1/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)
plt.gca().annotate(f'RT({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 2/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)
plt.gca().annotate(f'T({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 3/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'LT({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)


theta = 4/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'L({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 5/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'LB({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 6/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 7/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'RB({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.show()
In [51]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)
plt.gca().annotate(f'O({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 0/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
plt.gca().annotate(f'R({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 1/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)
plt.gca().annotate(f'RT({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 2/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)
plt.gca().annotate(f'T({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 3/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'LT({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)


theta = 4/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'L({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 5/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'LB({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 6/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'B({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

theta = 7/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)
plt.gca().annotate(f'RB({x}, {y})', xy = (x + .1, y + .1), fontsize = 10)

#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [53]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)

theta = 0/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

theta = 1/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)

theta = 2/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)

theta = 3/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)


theta = 4/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)

theta = 5/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)

theta = 6/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)

theta = 7/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)

#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()

make 16 dots

In [ ]:
x = 0
y = 0
plt.plot(x, y, marker = 'o', color = 'indigo', markersize = 7)

theta = 0/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)

theta = 1/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'pink', markersize = 7)

theta = 2/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'black', markersize = 7)

theta = 3/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)


theta = 4/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)

theta = 5/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)

theta = 6/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)

theta = 7/8 * 2 * pi
x = round(cos(theta), 1)
y = round(sin(theta), 1)
plt.plot(x, y, marker = 'o', color = 'green', markersize = 7)



#optional code
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()

use loop

In [54]:
for i in range(16):
    print(i)
    pass
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
for i in range(16): print(i) theta = 0/8 * 2 * pi x = round(cos(theta), 1) y = round(sin(theta), 1) plt.plot(x, y, marker = 'o', color = 'red', markersize = 7) pass
In [56]:
for i in range(16):
    print(i)
    
    theta = 0/8 * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
In [57]:
for i in range(16):
    print(i)
    
    theta = i/8 * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
In [58]:
for i in range(16):
    print(i)
    
    theta = i/8 * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
In [59]:
for i in range(16):
    print(i)
    
    theta = i/16 * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
In [60]:
for i in range(16):
    theta = i/16 * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [61]:
for i in range(4):
    theta = i/16 * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [62]:
parts = 4
for i in range(parts):
    theta = i/parts * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [63]:
parts = 10
for i in range(parts):
    theta = i/parts * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [64]:
parts = 100
for i in range(parts):
    theta = i/parts * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [65]:
parts = 500
for i in range(parts):
    theta = i/parts * 2 * pi
    x = round(cos(theta), 1)
    y = round(sin(theta), 1)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 7)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [70]:
parts = 1000
for i in range(parts):
    theta = i/parts * 2 * pi
    x = cos(theta)
    y = sin(theta)
    plt.plot(x, y, marker = 'o', color = 'red', markersize = 1)
    
    pass

plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()

linspace

In [78]:
linspace(0, 9, 10)
Out[78]:
array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
In [79]:
linspace(0, 2, 3)
Out[79]:
array([0., 1., 2.])
In [80]:
linspace(0, 2, 2)
Out[80]:
array([0., 2.])
In [75]:
parts = 1000

theta = linspace(0, 2 * pi, parts)
x = cos(theta)
y = sin(theta)
plt.plot(x, y, color = 'red')



plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [76]:
parts = 4

theta = linspace(0, 2 * pi, parts)
x = cos(theta)
y = sin(theta)
plt.plot(x, y, color = 'red')



plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [77]:
parts = 5

theta = linspace(0, 2 * pi, parts)
x = cos(theta)
y = sin(theta)
plt.plot(x, y, color = 'red')



plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()

draw pentagon, hexagon, septagon, octagon, naungon, decagon

In [ ]:
 
In [ ]:
 
In [84]:
parts = 1000

theta = linspace(0/4 * 2 * pi, 2/4 * 2 * pi, parts)
x = cos(theta)
y = sin(theta)
plt.plot(x, y, color = 'red')



plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [85]:
parts = 1000

theta = linspace(2/4 * 2 * pi, 4/4 * 2 * pi, parts)
x = cos(theta)
y = sin(theta)
plt.plot(x, y, color = 'red')



plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [87]:
parts = 1000

theta = linspace(1/8 * 2 * pi, 5/8 * 2 * pi, parts)
x = cos(theta)
y = sin(theta)
plt.plot(x, y, color = 'red')



plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [88]:
parts = 1000

theta = linspace(1/4 * 2 * pi, 4/4 * 2 * pi, parts)
x = cos(theta)
y = sin(theta)
plt.plot(x, y, color = 'red')



plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [89]:
parts = 1000

theta = linspace(2/8 * 2 * pi, 8/8 * 2 * pi, parts)
x = cos(theta)
y = sin(theta)
plt.plot(x, y, color = 'red')



plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
In [ ]:
 

Machine Learning

  1. Deal Banking Marketing Campaign Dataset With Machine Learning

TensorFlow

  1. Difference Between Scalar, Vector, Matrix and Tensor
  2. TensorFlow Deep Learning Model With IRIS Dataset
  3. Sequence to Sequence Learning With Neural Networks To Perform Number Addition
  4. Image Classification Model MobileNet V2 from TensorFlow Hub
  5. Step by Step Intent Recognition With BERT
  6. Sentiment Analysis for Hotel Reviews With NLTK and Keras
  7. Simple Sequence Prediction With LSTM
  8. Image Classification With ResNet50 Model
  9. Predict Amazon Inc Stock Price with Machine Learning
  10. Predict Diabetes With Machine Learning Algorithms
  11. TensorFlow Build Custom Convolutional Neural Network With MNIST Dataset
  12. Deal Banking Marketing Campaign Dataset With Machine Learning

PySpark

  1. How to Parallelize and Distribute Collection in PySpark
  2. Role of StringIndexer and Pipelines in PySpark ML Feature - Part 1
  3. Role of OneHotEncoder and Pipelines in PySpark ML Feature - Part 2
  4. Feature Transformer VectorAssembler in PySpark ML Feature - Part 3
  5. Logistic Regression in PySpark (ML Feature) with Breast Cancer Data Set

PyTorch

  1. Build the Neural Network with PyTorch
  2. Image Classification with PyTorch
  3. Twitter Sentiment Classification In PyTorch
  4. Training an Image Classifier in Pytorch

Natural Language Processing

  1. Spelling Correction Of The Text Data In Natural Language Processing
  2. Handling Text For Machine Learning
  3. Extracting Text From PDF File in Python Using PyPDF2
  4. How to Collect Data Using Twitter API V2 For Natural Language Processing
  5. Converting Text to Features in Natural Language Processing
  6. Extract A Noun Phrase For A Sentence In Natural Language Processing