【scipy】菲涅尔积分和羊角螺线

本文介绍了菲涅尔积分的概念,展示了如何使用Python的scipy库计算并绘制菲涅尔积分的曲线,包括实数域和复数域的结果。进一步,文章揭示了菲涅尔积分与羊角螺线之间的关系,通过图形化表示呈现出独特的视觉效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

菲涅尔积分简介

菲涅尔积分一般被写为 S ( x ) S(x) S(x) C ( x ) C(x) C(x),定义为

S ( x ) = ∫ 0 x sin ⁡ ( t 2 ) d t = ∑ n = 0 ∞ ( − 1 ) n x 4 n + 3 ( 2 n + 1 ) ! ( 4 n + 3 ) C ( x ) = ∫ 0 x cos ⁡ ( t 2 ) d t = ∑ n = 0 ∞ ( − 1 ) n x 4 n + 1 ( 2 n ) ! ( 4 n + 1 ) S(x)=\int^x_0\sin(t^2)\text dt=\sum^\infty_{n=0}(-1)^n\frac{x^{4n+3}}{(2n+1)!(4n+3)}\\ C(x)=\int^x_0\cos(t^2)\text dt=\sum^\infty_{n=0}(-1)^n\frac{x^{4n+1}}{(2n)!(4n+1)}\\ S(x)=0xsin(t2)dt=n=0(1)n(2n+1)!(4n+3)x4n+3C(x)=0xcos(t2)dt=n=0(1)n(2n)!(4n+1)x4n+1

接下来在scipy中调用fresnel,并绘制其曲线

import numpy as np
from scipy.special as ss
xs = np.arange(-500,500)/100
s, c = ss.fresnel(xs)
plt.plot(xs, s)
plt.plot(xs, c)
plt.show()

效果为

在这里插入图片描述

复数域的菲涅尔积分

scipy中的fresnel的定义域可拓展到复数域,则当其自变量为复数时,其函数图像如下

在这里插入图片描述

绘图代码为

fig = plt.figure()

ax = fig.add_subplot(2,3,1,projection='3d')
ax.plot_surface(xs, ys, np.real(c))
ax.set_title("real(c)")
ax = fig.add_subplot(2,3,2,projection='3d')
ax.plot_surface(xs, ys, np.imag(c))
ax.set_title("imag(c)")
ax = fig.add_subplot(2,3,3,projection='3d')
ax.plot_surface(xs, ys, np.abs(c))
ax.set_title("abs(c)")

ax = fig.add_subplot(2,3,4,projection='3d')
ax.plot_surface(xs, ys, np.real(s))
ax.set_title("real(s)")
ax = fig.add_subplot(2,3,5,projection='3d')
ax.plot_surface(xs, ys, np.imag(s))
ax.set_title("imag(s)")
ax = fig.add_subplot(2,3,6,projection='3d')
ax.plot_surface(xs, ys, np.abs(s))
ax.set_title("abs(s)")

plt.show()

也可以绘制其实部的为彩图,

xs, ys = np.indices([300,300])/100-1.5
s, c = ss.fresnel(xs + 1j*ys)
fig = plt.figure()
fig.add_subplot(1,2,1)
plt.imshow(np.real(c), cmap=plt.cm.prism)
plt.axis('off')
fig.add_subplot(1,2,2)
plt.imshow(np.real(s), cmap=plt.cm.prism)
plt.axis('off')
plt.show()

出图如下

在这里插入图片描述

羊角螺线

Fresnel积分但看上去似乎平平无奇,但二者一经结合,就会出现神奇的效果,这里甚至不需额外的操作,只需将二者之间的关系一一对应起来即可

plt.scatter(np.real(s), np.real(c), marker='.')
plt.show()

可以得到一个好像翅膀的图像

在这里插入图片描述

如果将实数的菲涅尔积分的sc分量的对应关系画出,则会得到所谓的羊角螺线

在这里插入图片描述

绘图代码为

xs = np.arange(-500,500)/100
s, c = ss.fresnel(xs)
plt.plot(s,c)
plt.grid()
plt.show()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

微小冷

请我喝杯咖啡

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值