Bendi新闻
>
陶哲轩:不懂数学别想靠ChatGPT飞升!
陶哲轩:不懂数学别想靠ChatGPT飞升!
5月前
数学不好的人,其实AI的帮助可能也没那么大
pip install matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# Define the range for x
x = np.linspace(0, 1, 400)
# Define the functions
functions = [lambda x: x, lambda x: x**2, lambda x: x**3, lambda x: x**4]
# Create a figure and axis
fig, ax = plt.subplots()
line, = ax.plot(x, functions[0](x))
# Set axis labels and title
ax.set_xlabel('x')
ax.set_ylabel('f(x)')
ax.set_title('Animated Functions')
# Initialize the animation function
def init():
line.set_ydata([np.nan] * len(x))
return line,
# Update the animation function
def update(frame):
line.set_ydata(functions[frame](x))
ax.set_title(f'Function: $x^{frame+1}$')
return line,
# Create the animation
ani = animation.FuncAnimation(
fig, update, frames=len(functions), init_func=init, blit=True, repeat=True, interval=1000
)
# Save the animation as a gif
ani.save('animated_functions.gif', writer='imagemagick')
plt.show()
pip install matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# Define the range for x
x = np.linspace(0, 1, 400)
# Define the functions
functions = [lambda x: x, lambda x: x**2, lambda x: x**3, lambda x: x**4]
# Create a figure and axis
fig, ax = plt.subplots()
line1, = ax.plot(x, functions[0](x), label='$x$')
line2, = ax.plot(x, functions[1](x), label='$x^2$')
# Set axis labels and title
ax.set_xlabel('x')
ax.set_ylabel('f(x)')
ax.legend()
ax.set_title('Animated Functions')
# Initialize the animation function
def init():
line1.set_ydata([np.nan] * len(x))
line2.set_ydata([np.nan] * len(x))
return line1, line2
# Update the animation function
def update(frame):
line1.set_ydata(functions[frame](x))
line2.set_ydata(functions[frame+1](x))
ax.legend([f'$x^{frame+1}$', f'$x^{frame+2}$'])
return line1, line2
# Create the animation
ani = animation.FuncAnimation(
fig, update, frames=len(functions)-1, init_func=init, blit=True, repeat=True, interval=1000
)
# Save the animation as a gif
ani.save('animated_double_functions.gif', writer='imagemagick')
plt.show()
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# Define the range for x
x = np.linspace(0, 1, 400)
# Define the functions
functions = [lambda x: x, lambda x: x**2, lambda x: x**3, lambda x: x**4]
# Create a figure and axis
fig, ax = plt.subplots()
line1, = ax.plot(x, functions[0](x), label='$x$')
line2, = ax.plot(x, functions[1](x), label='$x^2$')
# Set axis labels and title
ax.set_xlabel('x')
ax.set_ylabel('f(x)')
ax.set_title('Animated Functions')
# Initialize the animation function
def init():
line1.set_ydata([np.nan] * len(x))
line2.set_ydata([np.nan] * len(x))
return line1, line2
# Update the animation function
def update(frame):
line1.set_ydata(functions[frame](x))
line2.set_ydata(functions[frame+1](x))
ax.legend([f'$x^{frame+1}$', f'$x^{frame+2}$'])
return line1, line2
# Create the animation
ani = animation.FuncAnimation(
fig, update, frames=len(functions)-1, init_func=init, blit=True, repeat=True, interval=1000
)
# Save the animation as a gif
ani.save('animated_double_functions.gif', writer='imagemagick')
plt.show()
ChatGPT解释道:更新函数中的ax.legend()调用,就可以清除现有图例,并且使用每帧的新标签进行更新了。这样就可以确保,图例反映的是当前显示函数的功能。
pip install matplotlib
import numpy as np
import matplotlib.pyplot as plt
# Define the numerical values for the x and y positions
x_values = [1, 2, 3]
y_values = [1, 4, 9]
# Define the corresponding string labels for x and y axes
x_labels = ["Today", "Next week", "Next year"]
y_labels = ["Beginner", "Intermediate", "Expert"]
# Define the function to be plotted (y = x^2)
x = np.linspace(1, 3, 100)
y = x**2
# Create a figure and axis
fig, ax = plt.subplots()
# Plot the function
ax.plot(x, y, label='$y=x^2$')
# Set the x and y axis labels
ax.set_xlabel('Time')
ax.set_ylabel('Level')
# Set the x and y axis tick positions and labels
ax.set_xticks(x_values)
ax.set_xticklabels(x_labels)
ax.set_yticks(y_values)
ax.set_yticklabels(y_labels)
# Add a legend
ax.legend()
# Set the title
ax.set_title('Parabola $y=x^2$ with Custom Axis Labels')
# Display the plot
plt.show()
网友:图表存在「幻觉」
「资深用户」陶哲轩
微信扫码关注该文公众号作者
来源:硅星人Pro
相关新闻
陶哲轩最新采访:AI将颠覆数学界!用Lean规模化,成百上千条定理一次秒杀跨越300多年的接力:受陶哲轩启发,数学家决定用AI形式化费马大定理的证明秘密打造「AI陶哲轩」 震惊数学圈!谷歌IMO梦之队首曝光,菲尔兹奖得主深度点评这本书是对菲尔兹奖得主陶哲轩数学天赋的高度展现!!豆瓣高达9.8分!加州理工华人用AI颠覆数学证明!提速5倍震惊陶哲轩,80%数学步骤全自动化传奇大爷拿下“数学界诺贝尔奖”;陶哲轩祝贺:他本应更知名陶哲轩赵宇飞学生联手攻下组合数学难题,23年来首次突破陶哲轩转赞!40多年「忙碌海狸」数学难题获突破,4万行Coq代码立大功黎曼猜想显著突破!陶哲轩强推MIT、牛津新论文,37岁菲尔兹奖得主参与;恋爱时,学会关爱自己可以让两个人都更加幸福|本周值得读黎曼猜想显著突破!陶哲轩强推MIT、牛津新论文,37岁菲尔兹奖得主参与解析数论大牛获邵逸夫奖,陶哲轩:他的课好难AI将是数学家的得力助手,陶哲轩谈AI在证明过程中的潜力新架构Mamba更新二代!作者:别争了,数学上Transformer和SSM是一回事陶哲轩上新项目:Lean中证明素数定理,研究蓝图都建好了4人团队斩获首届AI奥数竞赛百万大奖!AI破解29题陶哲轩惊呆,CMU华人博士荣登第二唐嫣官宣喜讯,咖位飞升!全网炸了:恭喜啊,终于等到这一天了…陶哲轩看了都直呼内行!谷歌等用LLM自动证明定理拿顶会杰出论文,上下文越全证得越好陶哲轩牛津对谈罗博深:解密DeepMind如何让AI拿到IMO银牌一枚「弃子」打破80年黎曼猜想纪录!菲尔兹奖得主MIT大拿联手,陶哲轩转赞美国酝酿AI领域"登月计划",陶哲轩领衔62页报告重磅发布!美国酝酿AI「登月计划」,陶哲轩领衔62页报告重磅发布!“18岁以下不卖,别说你不懂!”49元一杯的网红酸奶,号称添加玛咖、鹿鞭等,遭网友疯狂吐槽,店员:女生喝了可能会长胡子别错过!专家提醒:买机票现在是最佳时机!多伦多飞中国这个价!“甩掉”小贝儿子罗密欧后,她事业飞升,身价千万。网友:大女主剧本啊!