[PYTHON] I had turtle draw a trigonometric function

I made it work with Python2.7, but I think Python3 is also okay.

import turtle as tur
import math

tur.shape('turtle')
tur.left(90)

A = 5
for k in range(360):
	tur.forward(1)
	tur.setheading(math.degrees(math.atan(A * math.cos(math.radians(k)))))

(Addition 2015/8/29 19:41) This is the execution result.

spam1.gif

Recommended Posts

I had turtle draw a trigonometric function
Let's draw a logistic function
I tried drawing a line using turtle
Draw a graph of a quadratic function in Python
I added a function to CPython (ternary operator)
[Python] Draw a Mickey Mouse with Turtle [Beginner]
Draw a graph in Julia ... I tried a little analysis
I tried to draw a route map with Python
I added a function to CPython (build & structure grasp)
I tried to draw a configuration diagram using Diagrams
〇✕ I made a game
Make a function decorator
I got a sqlite3.OperationalError
I made a function to check the model of DCGAN
I tried a little bit of the behavior of the zip function
[Visualization] I want to draw a beautiful graph with Plotly