Expinvsqlau_GIF.gif(800 × 600像素,文件大小:281 KB,MIME类型:image/gif、​循环、​11帧、​11秒)


摘要

描述
English: GIF version to illustrate the Laurent approximation of the function f(x)=exp(-1/x^2).
日期
来源 自己的作品
作者 IkamusumeFan

Matplotlib (Python)

# Author: Ika, 2013-08-24

import math as m
import numpy as np
import matplotlib.pyplot as plt
import scipy.special as sp
# import matplotlib.animation as animation
def draw_frame(n,filename,line_color):
	fig = plt.figure()
	plt.axes([0.02,0.13,0.9,0.8])
	plt.hold(True)
	plt.xlim(-3,3)
	plt.ylim(-2,4)
	# Set up the spines
	ax = plt.gca()
	ax.spines['right'].set_color('none')
	ax.spines['top'].set_color('none')
	ax.xaxis.set_ticks_position('bottom')
	ax.spines['bottom'].set_position(('data',0))
	ax.yaxis.set_ticks_position('left')
	ax.spines['left'].set_position(('data',0))
	# Set up the label
	ax.text(2,3,'N='+str(n),fontsize=24,color=line_color)

	Q = []
	X = np.arange(-3, 3, 0.001)
	# Draw the original function (ORG) curve
	ORG = np.exp(-1/(X*X))
	a = plt.plot(X, ORG, '-', color='black', lw=4)
	Q.append(a)
	# Draw the approximation function (APPR) curve
	i=1
	APPR = 1+(-1)**i*(X**(-2*i))/m.factorial(i)
	while (i<n):
		i = i+1
		APPR = APPR+(-1)**i*(X**(-2*i))/m.factorial(i)
	a = plt.plot(X, APPR, '-', color=line_color, lw=4)
	Q.append(a)
	
	plt.savefig(filename)

draw_frame(1,'frame01.eps','#b30000')
draw_frame(2,'frame02.eps','#00b300')
draw_frame(3,'frame03.eps','#0000b3')
draw_frame(4,'frame04.eps','#b3b300')
draw_frame(5,'frame05.eps','#00b3b3')
draw_frame(6,'frame06.eps','#b300b3')
draw_frame(7,'frame07.eps','#b3b3b3')
draw_frame(10,'frame08.eps','#3300b3')
draw_frame(50,'frame09.eps','#33b300')
draw_frame(65,'frame10.eps','#0033b3')
draw_frame(80,'frame11.eps','#b3b333')

# To generate the final GIF file, use the shell command:
# convert -antialias -loop 0 -delay 100 -compress LZW frame* Expinvsqlau_GIF.gif

许可协议

我,本作品著作权人,特此采用以下许可协议发表本作品:
w:zh:知识共享
署名 相同方式共享
您可以自由地:
  • 共享 – 复制、发行并传播本作品
  • 修改 – 改编作品
惟须遵守下列条件:
  • 署名 – 您必须对作品进行署名,提供授权条款的链接,并说明是否对原始内容进行了更改。您可以用任何合理的方式来署名,但不得以任何方式表明许可人认可您或您的使用。
  • 相同方式共享 – 如果您再混合、转换或者基于本作品进行创作,您必须以与原先许可协议相同或相兼容的许可协议分发您贡献的作品。

说明

添加一行文字以描述该文件所表现的内容

此文件中描述的项目

描繪內容

文件历史

点击某个日期/时间查看对应时刻的文件。

日期/时间缩⁠略⁠图大小用户备注
当前2013年8月26日 (一) 16:362013年8月26日 (一) 16:36版本的缩略图800 × 600(281 KB)IkamusumeFanRescale the image for better display.
2013年8月26日 (一) 06:202013年8月26日 (一) 06:20版本的缩略图612 × 792(81 KB)IkamusumeFanUser created page with UploadWizard

以下页面使用本文件:

全域文件用途

以下其他wiki使用此文件: