今天马斯克的 Grok3 发布——使用世界上目前最大的 GPU 集群训练得来:Colossus目前部署了10万个NVIDIA Hopper GPU,并计划扩展至20万个,其中包括5万个H100和5万个H200
然后 Grok 直接登顶。
发布会上用 Grok3 现场跑了几个问题。
其中一个是
Generate code for an animated 3d plot of a launch from earth landing on mars and then back to earth at the next launch window
Grok3 发布会问题
生成动画 3D 图代码,演示从地球发射、着陆火星,然后在下一个发射窗口返回地球的过程。
看起来很好玩的样子,于是我突发奇想,让 DeepSeek-R1 也来回答下,思考 5 分钟后,R1 给出的答案。
但是代码首次运行就报错,不着急,我们有用 Cursor 优化下,将问题加入 Chat,然后让他 fix !
最后的结果有点搞笑
由于代码已经被 Cursor 优化,我也没有仔细核对逻辑。最终的结果出现了飞船“闪现”,从地球直接闪现到另一个地方,再闪现回来。
并且和 Grok3 的比起来,火星和地球并没有绕着太阳旋转。
不过,起码证明 DeepSeek-R1 还是完整的给出了解决方案,不论是需要的库,还是整体的逻辑,其中只需要稍微调整一些数值计算逻辑。
其实能把这样一个只有文字描述的复杂问题“思考推理”到只需要微调的程度,我觉得就已经很强。
而像 Grok3 演示中那样,直接生成可正确运行的代码确实是很强的。
于是我让 Cursor 再次优化,让地球和火星绕着太阳转起来。
这一次飞船路径看起来像那么回事,但是还是会违反物理规律。
代码我贴在下面了,感兴趣的可以玩玩。
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib import animationfrom mpl_toolkits.mplot3d import Axes3D
# ConstantsAU = 1.496e8 # 1 Astronomical Unit in km (simplified)EARTH_ORBIT_RADIUS = 1.0 # in AU unitsMARS_ORBIT_RADIUS = 1.5 # in AU unitsTRANSFER_TIME = 250 # Frames for each transferWAIT_TIME = 50 # Frames waiting at Mars
# Initialize figurefig = plt.figure(figsize=(10, 8))ax = fig.add_subplot(111, projection='3d')ax.set_facecolor('black')
# Configure axes limitsax.set_xlim([-2, 2])ax.set_ylim([-2, 2])ax.set_zlim([-2, 2])
# Create celestial bodiessun = ax.scatter([0], [0], [0], color='yellow', s=200, label='Sun')earth_orbit, = ax.plot([], [], [], 'b--', alpha=0.5)mars_orbit, = ax.plot([], [], [], 'r--', alpha=0.5)earth = ax.scatter([], [], [], color='blue', s=80, label='Earth')mars = ax.scatter([], [], [], color='red', s=60, label='Mars')ship, = ax.plot([], [], [], 'w-', alpha=0.7)ship_pos = ax.scatter([], [], [], color='white', s=20)
# Generate orbit circlestheta = np.linspace(0, 2*np.pi, 100)earth_orbit.set_data(EARTH_ORBIT_RADIUS*np.cos(theta), EARTH_ORBIT_RADIUS*np.sin(theta))earth_orbit.set_3d_properties(np.zeros_like(theta))mars_orbit.set_data(MARS_ORBIT_RADIUS*np.cos(theta), MARS_ORBIT_RADIUS*np.sin(theta))mars_orbit.set_3d_properties(0.5*np.sin(theta)) # Add slight 3D variation
# Animation parametersframes = TRANSFER_TIME + WAIT_TIME + TRANSFER_TIMEphase = 'outbound'ship_path = [[], [], []]
def update(frame): global phase
# Calculate Earth and Mars positions earth_angle = 2*np.pi * frame/300 mars_angle = 2*np.pi * frame/500 # Slower orbit
earth_pos = (EARTH_ORBIT_RADIUS*np.cos(earth_angle), EARTH_ORBIT_RADIUS*np.sin(earth_angle), 0)
mars_pos = (MARS_ORBIT_RADIUS*np.cos(mars_angle), MARS_ORBIT_RADIUS*np.sin(mars_angle), 0.5*np.sin(mars_angle)) # 3D position
# Update planet positions earth._offsets3d = (earth_pos[0], earth_pos[1], earth_pos[2]) mars._offsets3d = (mars_pos[0], mars_pos[1], mars_pos[2])
# Spacecraft trajectory calculation if phase == 'outbound': if frame < TRANSFER_TIME: t = frame/TRANSFER_TIME # Transfer orbit calculations with slight 3D variation x = EARTH_ORBIT_RADIUS + (MARS_ORBIT_RADIUS - EARTH_ORBIT_RADIUS)*t y = 1.5*np.sin(t*np.pi) # Simple sinusoidal path z = 0.5*np.sin(t*np.pi) # 3D component ship_path[0].append(x) ship_path[1].append(y) ship_path[2].append(z) else: phase = 'waiting'
elif phase == 'waiting': if frame < TRANSFER_TIME + WAIT_TIME: # Stay at Mars' position ship_path[0].append(mars_pos[0]) ship_path[1].append(mars_pos[1]) ship_path[2].append(mars_pos[2]) else: phase = 'return'
elif phase == 'return': t = (frame - TRANSFER_TIME - WAIT_TIME)/TRANSFER_TIME if t <= 1: # Return trajectory with different 3D path x = MARS_ORBIT_RADIUS - (MARS_ORBIT_RADIUS - EARTH_ORBIT_RADIUS)*t y = 1.5*np.sin((1-t)*np.pi) z = -0.5*np.sin(t*np.pi) ship_path[0].append(x) ship_path[1].append(y) ship_path[2].append(z)
# Update spacecraft position if len(ship_path[0]) > 0: ship.set_data(ship_path[0], ship_path[1]) ship.set_3d_properties(ship_path[2]) ship_pos._offsets3d = ([ship_path[0][-1]], [ship_path[1][-1]], [ship_path[2][-1]])
return earth, mars, ship, ship_pos, earth_orbit, mars_orbit
# Create animationani = animation.FuncAnimation(fig, update, frames=frames, interval=20, blit=True)
# Add labels and legendax.set_xlabel('X (AU)')ax.set_ylabel('Y (AU)')ax.set_zlabel('Z (AU)')ax.legend(loc='upper left')
plt.show()
另一个问题是:结合俄罗斯方块和宝石迷阵两个游戏,生成一个新的混合体游戏。用 Python 编写。
但可能上一个问题占用了太多思考时间,这个问题 DeepSeek官网又进入了无法访问的“服务器繁忙,请稍后再试”的复读中。
无奈只能放弃。
但我突然想起,混元不也接入全量 DeepSeek 了吗
让我们去白嫖一下。
没想到,混元直接与时俱进,根据我的问题,直接定位了 Grok3的发布会,这也确实有点强,感觉这个助手深得我心。
不过初始结果依然还是无法立即让人满意。
于是,再次压榨,很好,可以看出他正在“思考”
不过就在我满心欢喜时,新的代码甚至无法直接运行。
经过 Cursor 的再次调整后,效果如下。
由于飞行器从地球飞往火星,再从火星飞回来本身就涉及复杂的天体物理和航天知识,只是依靠一句提示词和推理模型本身就完美解决问题并不现实。
如果能够解决的话,感觉 NASA 也很危险了!
但从这个问题,我们可以真正的看到推理模型真正的威力:给所有人一个开始的机会。
很多时候,由于缺乏相关领域的知识,我们遇到一些新的问题时,无从下手,但是借助推理模型,我们可以获得<Think>的启示,这种启示在DeepSeek 前很难获得,即使能获得,我们也需要付出不菲的代价。
另外一个收获就是要善于应用第三方的 DeepSeek-R1 全量模型。
如果感兴趣可以自行修改代码,以下是通过腾讯混元 DeepSeek-R1 生成的代码:
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib import animationfrom mpl_toolkits.mplot3d import Axes3D
# 天体参数(使用实际天文数据)AU = 1.49598e11 # 天文单位(米)MU_SUN = 1.32712440018e20 # 太阳引力参数 (m³/s²)
# 轨道参数earth_orbit = {'a': 1.0*AU, 'e': 0.017, 'T': 365.25} # 半长轴, 偏心率, 轨道周期(天)mars_orbit = {'a': 1.524*AU, 'e': 0.093, 'T': 687.0}transfer_orbit = {'a': (earth_orbit['a'] + mars_orbit['a'])/2} # 霍曼转移轨道
# 时间参数departure_window = 780 # 发射窗口间隔(天)sim_duration = 2 * departure_window # 总模拟时间frame_count = 500 # 动画帧数
# 初始化图形fig = plt.figure(figsize=(12, 10))ax = fig.add_subplot(111, projection='3d')ax.set_xlim(-2.5*AU, 2.5*AU)ax.set_ylim(-2.5*AU, 2.5*AU)ax.set_zlim(-0.5*AU, 0.5*AU)
# 添加太阳ax.scatter([0], [0], [0], c='yellow', s=200, label='Sun')
# 天体轨道计算函数def calculate_orbit(a, e, T, t): """计算椭圆轨道位置""" n = 2*np.pi / T # 平均角速度 M = n * t # 平近点角 # 近似求解开普勒方程 E = M + e*np.sin(M) # 偏近点角(简化计算) x = a*(np.cos(E) - e) y = a*np.sqrt(1-e**2)*np.sin(E) return x, y, np.zeros_like(t)
# 霍曼转移轨道计算def hohmann_transfer(t, t_departure, a_source, a_target, transfer_time): """计算霍曼转移轨道位置""" phase = (t - t_departure) / transfer_time valid = (phase >= 0) & (phase <= 1)
# 转移轨道参数 a_transfer = (a_source + a_target)/2 theta = np.pi * phase[valid]
# 椭圆参数方程 x = a_transfer*(np.cos(theta) - 1) + a_source y = a_transfer*np.sqrt(1 - ((a_source - a_transfer)/a_transfer)**2)*np.sin(theta) return x, y, np.zeros_like(x), valid
# 初始化天体轨迹t_sim = np.linspace(0, sim_duration, frame_count)
# 预计算天体位置earth_pos = calculate_orbit(earth_orbit['a'], earth_orbit['e'], earth_orbit['T'], t_sim)mars_pos = calculate_orbit(mars_orbit['a'], mars_orbit['e'], mars_orbit['T'], t_sim)
# 初始化飞船轨迹craft_traj = np.full((frame_count, 3), np.nan)
# 创建绘图对象earth_line, = ax.plot([], [], [], 'b-', alpha=0.5)mars_line, = ax.plot([], [], [], 'r-', alpha=0.5)craft_line, = ax.plot([], [], [], 'gold-', linewidth=2)earth_dot = ax.scatter([], [], [], c='blue', s=80)mars_dot = ax.scatter([], [], [], c='red', s=60)craft_dot = ax.scatter([], [], [], c='gold', s=100, marker='*')
# 动画更新函数def update(frame): current_t = t_sim[frame]
# 更新地球位置 earth_line.set_data(earth_pos[0][:frame], earth_pos[1][:frame]) earth_line.set_3d_properties(earth_pos[2][:frame]) earth_dot._offsets3d = ([earth_pos[0][frame]], [earth_pos[1][frame]], [0])
# 更新火星位置 mars_line.set_data(mars_pos[0][:frame], mars_pos[1][:frame]) mars_line.set_3d_properties(mars_pos[2][:frame]) mars_dot._offsets3d = ([mars_pos[0][frame]], [mars_pos[1][frame]], [0])
# 计算飞船位置 if frame == 0: craft_traj[:] = np.nan # 重置轨迹
# 第一次转移(地球->火星) transfer1_x, transfer1_y, _, valid1 = hohmann_transfer( current_t, t_departure=0, a_source=earth_orbit['a'], a_target=mars_orbit['a'], transfer_time=258 )
# 返回转移(火星->地球) transfer2_x, transfer2_y, _, valid2 = hohmann_transfer( current_t, t_departure=departure_window, a_source=mars_orbit['a'], a_target=earth_orbit['a'], transfer_time=258 )
# 组合轨迹 if valid1.any(): craft_traj[frame] = [transfer1_x[-1], transfer1_y[-1], 0] elif current_t < departure_window: craft_traj[frame] = [mars_pos[0][frame], mars_pos[1][frame], 0] elif valid2.any(): craft_traj[frame] = [transfer2_x[-1], transfer2_y[-1], 0]
# 更新飞船显示 craft_line.set_data(craft_traj[:frame,0], craft_traj[:frame,1]) craft_line.set_3d_properties(craft_traj[:frame,2]) craft_dot._offsets3d = ([craft_traj[frame,0]], [craft_traj[frame,1]], [0])
return earth_line, mars_line, craft_line, earth_dot, mars_dot, craft_dot
# 创建动画ani = animation.FuncAnimation( fig, update, frames=frame_count, interval=20, blit=True, repeat=False)
ax.legend(['Earth Orbit', 'Mars Orbit', 'Spacecraft Trajectory'])plt.title('Earth-Mars Round Trip Mission Animation')plt.show()
领取专属 10元无门槛券
私享最新 技术干货