Menu

[r4618]: / trunk / py4science / book / examples / mayavi / surf.py  Maximize  Restore  History

Download this file

20 lines (13 with data), 313 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
from mayavi.tools import imv
from scipy import exp,sin,linspace,pi
def f(x,y):
return 5*exp(-(x**2+y**2))*(sin(x+y))
def g(x,y):
r2 = x**2+y**2
return 0.5+3*exp(-r2)*(sin(r2))
npts = 40
x = y = linspace(-pi,pi,npts)
imv.surf(x,y,f)
imv.surf(x,y,g)
mv = imv.surf(x,y,f)
imv.surf(x,y,g,viewer=mv)
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.