Menu

[r2807]: / trunk / course / examples / scipy / example4.3  Maximize  Restore  History

Download this file

14 lines (10 with data), 411 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
>>> from integrate import quad, Inf
>>> def integrand(t,n,x):
return exp(-x*t) / t**n
>>> def expint(n,x):
return quad(integrand, 1, Inf, args=(n, x))[0]
>>> vec_expint = vectorize(expint)
>>> vec_expint(3,arange(1.0,4.0,0.5))
array([ 0.1097, 0.0567, 0.0301, 0.0163, 0.0089, 0.0049])
>>> special.expn(3,arange(1.0,4.0,0.5))
array([ 0.1097, 0.0567, 0.0301, 0.0163, 0.0089, 0.0049])
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.