Re: two graphs have different color on surface
- To: mathgroup at smc.vnet.net
- Subject: [mg95695] Re: [mg95670] two graphs have different color on surface
- From: "David Park" <djmpark at comcast.net>
- Date: Sun, 25 Jan 2009 06:50:41 -0500 (EST)
- References: <26857859.1232798005026.JavaMail.root@m02>
Steven, I would suggest using ColorFunctionScaling -> False, and Rescale to control precisely how the color function is working. Here is plot statement that plots the Im part of the function, and also color according to the Im part. The purpose of this to see if we are getting precisely what we want. ComplexColorPlot3[func_, {xmin_, xmax_}, {ymin_, ymax_}, opts___?OptionQ] := Module[{x, y}, Plot3D[Im[func[x + I y]], {x, xmin, xmax}, {y, ymin, ymax}, opts, ColorFunctionScaling -> False, ColorFunction -> (ColorData["Rainbow"][ Rescale[Im@func[#1 + I*#2], {-1, 1}]] &)]] ComplexColorPlot3[Sqrt, {-1, 1}, {-1, 1}, ViewPoint -> {1.227, -1.942, 3.028}, Mesh -> None] And there the coloring property tracks the height of the Im surface. Then we change to a Re surface and an Im coloring. ComplexColorPlot4[func_, {xmin_, xmax_}, {ymin_, ymax_}, opts___?OptionQ] := Module[{x, y}, Plot3D[Re[func[x + I y]], {x, xmin, xmax}, {y, ymin, ymax}, opts, ColorFunctionScaling -> False, ColorFunction -> (ColorData["Rainbow"][ Rescale[Im@func[#1 + I*#2], {-1, 1}]] &)]] ComplexColorPlot4[Sqrt, {-1, 1}, {-1, 1}, ViewPoint -> {1.227, -1.942, 3.028}, Mesh -> None] I think that is your plot. However, I don't especially like this because two comparable things, the Re and Im parts of the function, are represented in entirely different manners in the graphic. It might be better to do Re and Im surface plots side by side. Or possibly a polar density plot of the modulus with argument contour lines on top of it. The Presentations package has technology for representing such multivalued functions on a Riemann surface without any branch line discontinuities. The function is single valued and continuous everywhere on the surface. The Sqrt case is one example given in the documentation. Needs["Presentations`Master`"] DynamicModule[{zpt = {1.5, 0}, w, root}, Module[ {f = Function[z, Sqrt[z]], sqrtz, z, zcenter = 0}, sqrtz = Multivalues[Null, {Sqrt[z], -Sqrt[z]}, z]; Row[ {Draw2D[ {ComplexPolarDensityDraw[ Abs[f[z]], {z, ComplexPolar[0, -\[Pi]], ComplexPolar[3, \[Pi]], zcenter}, ColorFunctionScaling -> False, ColorFunction -> (ColorData["GrayYellowTones"][ Rescale[#, {0, Sqrt[3]}]] &), Mesh -> {Sqrt /@ Range[.5, 3, .5]}, MeshFunctions -> (Abs[Sqrt[#1]] &), PlotPoints -> {5, 10} 4, MaxRecursion -> 0, PlotRange -> {0, 3}], Dynamic@ Arrow[{zpt, zpt + 1/2 ToCoordinates[ root = Extract[ CalculateMultivalues[sqrtz][ToComplex[zpt]], {1, 1}]]}], Locator[Dynamic[zpt], Graphics[{CirclePoint[{0, 0}, 3, Black, Red]}]]}, Frame -> True, FrameLabel -> {Re, Im}, PlotRange -> 3, PlotLabel -> Row[{f["z"], " as a Rieman Surface"}], Background -> None, ImageSize -> 350], Dynamic@Column[ {ComplexArgumentPanel[ToComplex[zpt], {True, True, False}, Row[{"z", Spacer[20]}], {Left, Center}, ImageSize -> {185, 42}], ComplexArgumentPanel[root, {True, True, False}, Row[{f["z"]}], {Left, Center}, ImageSize -> {185, 42}]}](* Column *)}, Spacer[20]](* Row *) ] ] This gives a polar density plot of the Modulus as a background. There is a red CirclePoint locator that has an arrow attached to it. The arrow represents the value of the complex function at the locator. The values of z and Sqrt[z] are also dynamically displayed to the right of the graphic in both Cartesian and polar form. Initially the arrow points to the right. If you drag the locator around the origin once, the arrow will point to the left. One has to circle the origin twice to get back to the original value. One does not actually 'see' the Riemann surface, only its effects. One can move anywhere around it, recapture both values of Sqrt[z] and get back to the original point without any jumps, artifacts or discontinuities. Just like Riemann said. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Steven Siew [mailto:stevensiew2 at gmail.com] I have tried to produce a graph where the color on the surface depends on the value of z. When I tried doing it in two different ways, the color are different on the two graphs even though as far as I can fee they should be the same. The code are as below ComplexColorPlot[func_, {xmin_, xmax_}, {ymin_, ymax_}, opts___?OptionQ] := Module[{x, y}, Plot3D[Re[func[x + I y]], {x, xmin, xmax}, {y, ymin, ymax}, opts, ColorFunction -> (ColorData["Rainbow"][ Re@func[#1 + I*#2]] &) ] ] ComplexColorPlot2[func_, {xmin_, xmax_}, {ymin_, ymax_}, opts___?OptionQ] := Module[{x, y}, Plot3D[Re[func[x + I y]], {x, xmin, xmax}, {y, ymin, ymax}, opts, ColorFunction -> (ColorData["Rainbow"][#3] &) ] ] ComplexColorPlot[Sqrt, {-1, 1}, {-1, 1}, ViewPoint -> {1.227, -1.942, 3.028}, PlotPoints -> {50, 50}] ComplexColorPlot2[Sqrt, {-1, 1}, {-1, 1}, ViewPoint -> {1.227, -1.942, 3.028}, PlotPoints -> {50, 50}] I expect the functions ComplexColorPlot2 and ComplexColorPlot to produce identical color graphs when given identical inputs but they dont. And I'm at loss as to why they dont. My ultimate objective is to have the color reflect the value of Im[func [x+I*y]] but I'm great difficulties in achieving it.