Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In reading Michael Trott's Visualization of Riemann Surfaces of Algebraic Functions, he has:

ParametricPlot3D[{r Cos[φ], r Sin[φ], Sqrt[r] Sin[φ/2], 
  SurfaceColor[Hue[φ/(4 π)]]}, {r, 0, 1}, {φ, 0, 4 π},
  PlotPoints -> {20, 60}, Boxed -> False, Axes -> False]

How would you do this coloring now in Mathematica 9 ?

share|improve this question
add comment

2 Answers 2

Natively in V9, you can do the following:

ParametricPlot3D[{r Cos[phi], r Sin[phi], Sqrt[r] Sin[phi/2]}, {r, 0, 1}, 
 {phi, 0, 4 Pi}, PlotPoints -> {20, 60}, Boxed -> False, Axes -> False,
  ColorFunction -> (Hue[#5/(4 Pi)] &), ColorFunctionScaling -> False]

enter image description here

Alternatively, you can always use the exact code using the V5 emulator:

<<Version5`Graphics`
ParametricPlot3D[{r Cos[phi], r Sin[phi], Sqrt[r] Sin[phi/2], 
  SurfaceColor[Hue[phi/(4 Pi)]]}, {r, 0, 1}, {phi, 0, 4 Pi}, 
  PlotPoints -> {20, 60}, Boxed -> False, Axes -> False]

enter image description here

Of course, the graphics aren't quite as nice. You can go back to the newer style graphics as follows:

<<Version6`Graphics`
share|improve this answer
add comment

As of Version 6, SurfaceColor has been superseded by Specularity and Glow.

One could specify the variables explicitly like here :

ParametricPlot3D[{ r Cos[φ], r Sin[φ], Sqrt[r] Sin[φ/2]}, {r, 0, 1}, {φ, 0, 4 π},
   ColorFunction -> Function[{x, y, z, r, φ, θ},
                      {Specularity[#], Glow[#]}& @ Hue[Rescale[φ, {0, 1}]]],
   PlotPoints -> {20, 60}, Boxed -> False, Axes -> False]

enter image description here

or adding a more thrilling variation of ColorFunction (singularity when r -> 0) :

ParametricPlot3D[{ r Cos[φ], r Sin[φ], Sqrt[r] Sin[φ/2]}, {r, 0, 1}, {φ, 0, 4 π},
    ColorFunction -> Function[{x, y, z, r, φ, θ},
                       {Specularity[#], Glow[#]}& @ Hue[ Rescale[ φ/r, {0, 1}]]],
    PlotPoints -> {20, 60}, Boxed -> False, Axes -> False]

enter image description here

share|improve this answer
1  
I think you're missing an argument. It should be Function[{x, y, z, r, φ}, ...]. –  Rahul Narain Dec 28 '12 at 22:58
    
Yes, I improved the arguments. Thanks. –  Artes Dec 28 '12 at 23:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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