4
$\begingroup$

I try to make a quick tool for "plotting" complex valued functions. Therefore I generate a Table of complex valued points lying in the complex plane building a filled square.

(* map interval linear onto another *)
Transf[val_, A_, B_, a_, b_] := (val - A)*(b - a)/(B - A) + a; 

(* build up realpart *)
U[t_] := Transf[t, 0, numberOfPoints, -Size, Size];   

(* build up imaginary art *)
V[t_] := Transf[t, 0, numberOfPoints, -Size, Size];   

(* now generate points in the complex plane *)
A = Flatten[
   Table[
     Table[U[u] + I*V[v]      +       CenterX + I*CenterY,
        {u, 0, numberOfPoints}],
     {v, 0, numberOfPoints}
   ]
];

(* the function that is to be plotted *)
f[z_] = z^2; 

I put all of this into a Manipulate[] to have control over numberOfPoints,Size which controls how wide the points spread and also the center of the square using CenterX, CenterY.

So far so good. Then I plot those points using

Needs["ComputationalGeometry`"]
PlanarGraphPlot[{Re[#], Im[#]} & /@ A, LabelPoints -> False],

I also use this to plot the points after they get mapped with f[A]. This looks like this:

PlanarGraphExample

Obviously Mathematica is recalculating the triangulation for the list f[A]. But I need Mathematica to draw triangles between those points, which shared a triangle before. Then one could get a better imagination on what the complex valued function f[z] = z^2 does to the geometry of the square. How could I do that?

$\endgroup$
4
$\begingroup$
numberOfPoints = 5; Size = 2; CenterX = 0; CenterY = 0; 

pgp = PlanarGraphPlot[ReIm @ A, LabelPoints -> False];
dg = DiscretizeGraphics[pgp];
prims = MeshCells[dg, All];

You can use prims with MeshRegion:

Quiet @ MeshRegion[ReIm @ f @ A, prims]

enter image description here

or with GraphicsComplex + Graphics:

Graphics[GraphicsComplex[ReIm @ f @ A, prims]]

enter image description here

Alternatively, construct a Graph object from dg and use ReIm @ f @ A as its VertexCoordinates:

edges = MeshCells[dg, 1] /. Line -> Apply[UndirectedEdge];
vertices = Range[MeshCellCount[dg, 0]];

{g1, g2} = Graph[vertices, edges, VertexCoordinates -> ReIm @ #, 
     ImageSize -> Medium] & /@ {A, f @A};

Row[{g1, g2}, Spacer[10]]

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.