Re: [問卦] 鄉民救命!這題數學題快把我逼瘋了!
幫ChatGPT debug一個小時
終於寫出來了
看程式碼是圓周兩倍沒錯
這個問題的難度會把ChatGPT
給考倒
https://i.imgur.com/MoR4WtI.gif
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
from matplotlib.animation import FuncAnimation
plt.rcParams['animation.ffmpeg_path'] = '/usr/local/bin/ffmpeg' #請確定你的ffm
peg的路徑
fig, ax = plt.subplots()
circle1 = patches.Circle((0, 0), 1, fc='b') # Blue circle
circle2 = patches.Circle((2, 0), 1, fc='r') # Red circle
arrow = None # Placeholder for the arrow
dist_text = ax.text(-2.5, 2.5, '') # Text object for the distance
dist = 0 # Initial distance
def init():
ax.add_patch(circle1)
ax.add_patch(circle2)
ax.set_xlim(-3, 3)
ax.set_ylim(-3, 3)
ax.set_aspect('equal', adjustable='box')
def animate(i):
global arrow, dist # We'll modify the arrow and dist, so we need to decla
re them as global
t = np.radians(i)
x = 2*np.cos(t) # Multiply the cosine and sine values by 2 (the sum of th
e radii)
y = 2*np.sin(t) # to have the edge of circle2 touch the edge of circle1
circle2.center = (x, y)
if arrow is not None: # If an arrow already exists, remove it
arrow.remove()
arrow = patches.FancyArrow(x, y, 0.5*np.cos(t+np.pi/2), 0.5*np.sin(t+np.pi
/2), color='g') # Create a new arrow
ax.add_patch(arrow) # Add the new arrow to the axes
dist = t * 1 # The radius of the red circle is 1
dist_text.set_text(f'Distance: {dist:.2f} units') # Update the text objec
t
ani = FuncAnimation(fig, animate, init_func=init, frames=360, repeat=True)
plt.show()
# Save the animation
#ani.save('animation.gif', writer='pillow', fps=30)
※ 引述《a205090a (不再)》之銘言:
剛剛有個朋友突然丟一道題目給我
內容如下
把兩個10元硬幣上下排列,上面的是A下面的是B,現在用A貼著B旋轉一圈直到回到原點,
請
問A一共需要轉幾圈??
我把我的答案丟給朋友
結果是錯的欸
這答案也太反直覺了吧??
有鄉民能第一次就答對嗎??
有沒有卦??
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.217.229.148 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Gossiping/M.1689606997.A.A11.html
推
07/17 23:17,
10月前
, 1F
07/17 23:17, 1F
→
07/17 23:20,
10月前
, 2F
07/17 23:20, 2F
推
07/17 23:30,
10月前
, 3F
07/17 23:30, 3F
→
07/17 23:30,
10月前
, 4F
07/17 23:30, 4F
→
07/17 23:30,
10月前
, 5F
07/17 23:30, 5F
我叫ChatGPT把移動距離印出來
結果是2 Pi
為什麼呢?
→
07/17 23:32,
10月前
, 6F
07/17 23:32, 6F
→
07/17 23:32,
10月前
, 7F
07/17 23:32, 7F
推
07/17 23:44,
10月前
, 8F
07/17 23:44, 8F
※ 編輯: lono (180.217.229.148 臺灣), 07/17/2023 23:48:23
→
07/17 23:46,
10月前
, 9F
07/17 23:46, 9F
→
07/17 23:47,
10月前
, 10F
07/17 23:47, 10F
→
07/17 23:47,
10月前
, 11F
07/17 23:47, 11F
→
07/17 23:47,
10月前
, 12F
07/17 23:47, 12F
→
07/17 23:52,
10月前
, 13F
07/17 23:52, 13F
→
07/17 23:52,
10月前
, 14F
07/17 23:52, 14F
我看不出來ChatGPT哪裡寫錯
它堅持它的答案是對的
https://i.imgur.com/r1U33iN.jpg
※ 編輯: lono (180.217.229.148 臺灣), 07/18/2023 00:06:25
※ 編輯: lono (180.217.229.148 臺灣), 07/18/2023 00:08:45
※ 編輯: lono (180.217.229.148 臺灣), 07/18/2023 00:12:15
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):