LoginSignup
1
2

More than 5 years have passed since last update.

turtleに三角関数を描いてもらった

Last updated at Posted at 2015-08-29

Python2.7で動作させましたが,多分Python3でも大丈夫だと思います.

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)))))

(追記 2015/8/29 19:41) 実行結果です.

spam1.gif

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2