質問するログイン新規登録

質問編集履歴

1

ご指摘いただいたソースコードのインデントを修正し、itaのコードを追加しました。

2020/02/09 17:28

投稿

hirashun
hirashun

スコア6

title CHANGED
File without changes
body CHANGED
@@ -47,7 +47,7 @@
47
47
  draw_stick(0, 50, round(cur_y), round(cur_x), [1,1, 0], image)
48
48
  #その時刻の物体と天井を結ぶ棒を描く
49
49
  images[i] = image
50
- return images
50
+ return images
51
51
 
52
52
  def draw_circle(r, center_y, center_x, color, image):
53
53
  #点(center_x, center_y)上に半径rの円を描く
@@ -104,4 +104,53 @@
104
104
  振り子運動の状況設定としては、長さlの棒に重りをつるしたものを考えています。重りの円弧方向の微分方程式を差分化して得られる式、
105
105
  **__(θ(t+ Δt)-2θ(t)+ θ(t- Δt))/(Δt^2 )= -g/l sinθ(t)__**
106
106
  をもとに、
107
- **__Δt= time_stride = 0.3__** として、2秒間の運動のシミュレーションを行っています。
107
+ **__Δt= time_stride = 0.3__** として、2秒間の運動のシミュレーションを行っています。
108
+ 以下はエラーが起きているitaのコードです。
109
+
110
+ ```Python
111
+ # -*- encoding: utf-8 -*-
112
+
113
+ from . import array
114
+ from . import plot
115
+ from . import bench
116
+ from . import excheck
117
+
118
+ def lifegame_glider():
119
+ return [[0,0,0,0,0,0,0,0],
120
+ [0,0,0,0,0,0,0,0],
121
+ [0,0,0,0,0,0,0,0],
122
+ [0,0,0,0,0,0,0,0],
123
+ [0,0,0,0,1,1,1,0],
124
+ [0,0,0,0,1,0,0,0],
125
+ [0,0,0,0,0,1,0,0],
126
+ [0,0,0,0,0,0,0,0]]
127
+
128
+ def lifegame_acorn():
129
+ # Corderman's Acorn
130
+ image = array.make2d(60,80)
131
+ x = 60
132
+ y = 30
133
+ for i in [[0,1],[1,3],[2,0],[2,1],[2,4],[2,5],[2,6]]:
134
+ image[y + i[0]][x + i[1]] = 1
135
+ return image
136
+
137
+ import random as rnd
138
+
139
+ # 身長体重データ疑似生成用
140
+ def gen_hw_data():
141
+ s = rnd.randint(0,1)
142
+ h = int(rnd.gauss(155+s*18, 10))
143
+ t = rnd.randint(0,1)
144
+ wd = (h/100) ** 2 * (19+3*t)
145
+ w = int(wd + rnd.betavariate(2,10) * 200 - 15)
146
+ return (h,w)
147
+
148
+ # バネの延びデータ疑似生成用
149
+ def gen_spring_data():
150
+ w = rnd.randint(0,200)
151
+ l = int(2 * w * rnd.gauss(1, 0.1))
152
+ return (w,l)
153
+
154
+
155
+
156
+ ```