For Programmers: Free Programming Magazines  


Home > Archive > Mathematica > July 2007 > SphericalPlot3D in Version 6.0









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SphericalPlot3D in Version 6.0
Januk

2007-07-25, 4:28 am

Hi all,

Does SphericalPlot3D offer anything over ParametricPlot3D in terms of
its handling of functions? As far as I can tell, the following two
lines give me pretty well exactly the same result, except that
SphericalPlot3D line takes nearly twice as long as ParametricPlot3D.

f[th_, ph_] := Cos[th] Sin[ph] (* Note this is an extremely simple
example of what I really want *)

Timing[
SphericalPlot3D[f[th, ph], {ph, 0, \[Pi]}, {th, 0, 2 \[Pi]},
PlotRange -> All, ImageSize -> 600]
];

Timing[
ParametricPlot3D[
f[th, ph] {Cos[th] Sin[ph], Sin[th] Sin[ph], Cos[ph]}, {ph,
0, \[Pi]}, {th, 0, 2 \[Pi]}, PlotRange -> All, ImageSize -> 600]
]

Other than the shorter syntax, is there any advantage to using
SphericalPlot3D?

Thanks,
Januk


Brett Champion

2007-07-26, 8:14 am

On Jul 25, 2007, at 1:10 AM , Januk wrote:

> Hi all,
>
> Does SphericalPlot3D offer anything over ParametricPlot3D in terms of
> its handling of functions? As far as I can tell, the following two
> lines give me pretty well exactly the same result, except that
> SphericalPlot3D line takes nearly twice as long as ParametricPlot3D.
>
> f[th_, ph_] := Cos[th] Sin[ph] (* Note this is an extremely simple
> example of what I really want *)
>
> Timing[
> SphericalPlot3D[f[th, ph], {ph, 0, \[Pi]}, {th, 0, 2 \[Pi]},
> PlotRange -> All, ImageSize -> 600]
> ];
>
> Timing[
> ParametricPlot3D[
> f[th, ph] {Cos[th] Sin[ph], Sin[th] Sin[ph], Cos[ph]}, {ph,
> 0, \[Pi]}, {th, 0, 2 \[Pi]}, PlotRange -> All, ImageSize -> 600]
> ]
>
> Other than the shorter syntax, is there any advantage to using
> SphericalPlot3D?


Everything SphericalPlot3D does can be done with ParametricPlot3D.

SphericalPlot3D packages things up a bit, including adding additional
parameters for color functions, mesh functions, and region functions.

Hopefully the speed will improve in the next release.

Brett Champion
Wolfram Research

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com