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.

According to the docs, the meaning of the arguments passed to ParametricPlot3D is $x, y, z, u, v$. This is 5 arguments: the Cartesian coordinates and the two parameters. Similarly, for ParametricPlot it's $x, y, u, v$.

Let's look at how many arguments are actually passed to the ColorFunction:

Reap[ParametricPlot3D[{Cos[u] Cos[v], Sin[u] Cos[v], Sin[v]}, 
       {u, 0, 2 Pi}, {v, -Pi/2, Pi/2}, ColorFunction -> ((Sow[{##}]; Gray) &)]]

If you evaluate this, you'll notice that actually 6 arguments are passed to the colour function, but the last one is always zero. If we use the one-parameter form of ParametricPlot3D, then still six arguments will be passed, but now the last two are zero.

Reap[ParametricPlot3D[{Cos[u], Sin[u], 0}, {u, 0, 2 Pi}, 
  ColorFunction -> ((Sow[{##}]; Gray) &)]]

Similarly, the colour function of ParametricPlot receives 5 arguments instead of 4.

What is the meaning of the last argument passed to the ColorFunction of these functions? Does it have any use? Does ParametricPlot3D have a form where the last argument of the colour function will not be zero and has an application?

share|improve this question
    
I just tested with RegionPlot3D and plain Plot: Both also add an extra 0. argument. –  celtschk May 16 '12 at 12:20
7  
"Reserved for future use"? –  Sjoerd C. de Vries May 16 '12 at 12:52
    
@Sjoerd Well, they could always just add one more argument ... –  Szabolcs May 21 '12 at 14:58
    
Interesting -- this explians why a color function defined per the ColorFunction docs with 5 arguments doesn't work!! mycolor[x_, y_, z_, u_, v_] := Red; ParametricPlot3D[{Cos[u] Cos[v], Sin[u] Cos[v], Sin[v]}, {u, 0, 2 Pi}, {v, -Pi/2, Pi/2}, ColorFunction -> (mycolor[##] &)] produces an 'uncolored' figure.. Apologies I cant see how to post a comment vs an 'answer' here.. –  george2079 Aug 20 '12 at 22:07
add comment

1 Answer 1

This is a bit speculative but I note that SphericalPlot3D[] supplies its ColorFunction with 6 args, being x, y, z, theta, phi, and r. SphericalPlot3D can be shown to call ParametricPlot3D, so I'd surmise the extra argument is left there for compatibility.

share|improve this answer
    
Sounds plausible +1 –  belisarius Aug 21 '12 at 19:45
1  
How did you find this out? Did you use Trace? –  rcollyer Aug 22 '12 at 2:13
2  
Unprotect[ParametricPlot3D];ParametricPlot3D[arg___] := (Print["arg list is", {arg}]); SphericalPlot3D[1, {t, 0, 2 Pi}, {p, -Pi/2, Pi/2}, ColorFunction -> colorfunction ] –  george2079 Aug 22 '12 at 14:43
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.