JavaView used to show complex function
Source code name: "javaview_complex_function.py"
Programming language: Python
Topic: Function/2D
DMelt Version 2.5. Last modified: 06/23/1974. License: Pro
https://datamelt.org/code/cache/javaview_complex_function_1839.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


# Describes parametrized surfaces over a two dimensional domain.
# Parameter domain allows adjustments.
# Konrad Polthier, Sergei Chekanov

from jv.function import PuComplexFunction 
from jvx.surface import PgDomainDescr,PgDomain,PgParmSurface
from jhplot import HJavaView
from jv.geom import PgElementSet
from java.awt import Color 
from jv.number import PuComplex

m_domain = PgDomain(2)
m_domain.setVisible(True)
m_domain.setName("Domain of Graph")
m_domain.setDimOfElements(4)

descr = m_domain.getDescr()
descr.setMaxSize(-10., -10., 10., 10.)
descr.setSize(-2.,-2., 2., 2.)
descr.setDiscrBounds(2, 2, 50, 50)
descr.setDiscr(20, 20)
m_domain.init()
m_domain.setName("Complex Domain")
m_domain.showElements(False)
m_domain.makeVertexColorsFromXYZ()
m_domain.showEdgeColorFromVertices(True)
m_domain.showEdgeColors(True)
m_domain.setGlobalEdgeColor(Color(161, 161, 161))
m_domain.setGlobalElementColor(Color.white)

m_image  = PgElementSet(2)
# Complex-valued function in one variable
m_function  = PuComplexFunction(1, 1)
m_function.setName("Complex Function")
m_function.setVariables(["z"])
m_function.setExpression("z*z")

m_image.setName("Complex Map");
m_image.setGlobalEdgeColor(Color.blue);
m_image.copy(m_domain)

nov = m_domain.getNumVertices()
vertex  = m_domain.getVertices()
src     = PuComplex()
dest    = PuComplex()
for i in range(nov):
     src.set(vertex[i].m_data[0], vertex[i].m_data[1])
     # Apply function.
     dest.copy(m_function.eval(src))
     m_image.setVertex(i, dest.re(), dest.im())



c1=HJavaView()
c1.visible()
c1.draw(m_domain)
c1.draw(m_image)


You see the box below because you did not login.