File:Sine3D.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(939 × 542 pixels, file size: 95 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: This image was created with the help of mayavi2 and numpy.

This is the python code:

from numpy import *
from enthought.mayavi import mlab

def complex_plot(function, 
                 maxval=9, 
                 xbounds=(-3.0,3.0), 
                 ybounds=(-3.0,3.0), 
                 stepsize=0.01, 
                 text="", 
                 textwidth=0.1, 
                 unitcylrange=(-4,4), 
                 zmax=9, 
                 zmin=-9, 
                 legend=True,
                 signed=True):
    try:
        engine = mayavi.engine
    except NameError:
        from enthought.mayavi.api import Engine
        engine = Engine()
        engine.start()

    f=mlab.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1), size=(500,500))
    x,y = mgrid[xbounds[0]:xbounds[1]:stepsize, ybounds[0]:ybounds[1]:stepsize]
    if signed:
        z = maximum(minimum(abs(function(x+y*1j))*sign(real(function(x+y*1j))), zmax), zmin)
    else:
        z = maximum(minimum(abs(function(x+y*1j)), zmax), zmin)
    s = angle(function(x+y*1j))
    m=mlab.mesh(x,y,z, scalars=s)
    from enthought.mayavi.modules.axes import Axes
    axes = Axes()
    engine.add_filter(axes, m.module_manager)

    mlab.text(0, 0, text, width=textwidth)
    phi, v=mgrid[0.0:2.01*pi:0.1, unitcylrange[0]:unitcylrange[1]:0.1]
    mlab.mesh(cos(phi),sin(phi),v, color=(1,1,1), opacity=0.5)
    if legend:
        mlab.colorbar(title="phase", orientation='vertical')

complex_plot(lambda z: sin(z), text="f(z) = sin(z)", xbounds=(-2*pi, 2*pi), zmin=-5, zmax=5,textwidth=0.3, ybounds=(-2,2), stepsize=0.01)
mlab.show()
Date
Source Own work
Author Hans Baier
Other versions Sine.png

Licensing[edit]

Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current22:08, 12 June 2009Thumbnail for version as of 22:08, 12 June 2009939 × 542 (95 KB)Hansfbaier (talk | contribs){{Information |Description={{en|1=This image was created with the help of mayavi2 and numpy. This is the python code: <pre> from numpy import * from enthought.mayavi import mlab def complex_plot(function, maxval=9, xb

There are no pages that use this file.