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.

I was wondering if I could speed up SphericalPlot3D? I tried editing PlotPoints, and MaxRecursion, but when I wrap SphericalPlot3D with Manipulate it fails. I don't want to set ContinuousAction to False.

Manipulate[ SphericalPlot3D[{r, 0, rmax}, {\[Phi], 0, phi \[Pi]}, 
  {\[Theta], 0, theta \[Pi]}, SphericalRegion -> True, PlotRange -> 4, 
  Mesh -> 2, Ticks -> None], 
  {theta, 0.07, 1}, {phi, 0.07, 2}, {rmax, 0.07, 4}, SaveDefinitions -> True]

I wanted to layer a whole bunch of shells together to make a solid. {r, 0,rmax} specifies what range of shells' radii I want to create

share|improve this question
2  
Your code does not make sense. You use r inside your Manipulate which is not defined. Otherwise, it works quite fast. –  halirutan Aug 14 '12 at 1:44
    
Get a better machine; it is very fast and smooth on my laptop. Also try PerformanceGoal -> "Quality" in your plotting function to avoid evaluating twice –  rm -rf Aug 14 '12 at 2:00
    
The problem might be that your r is inefficient to evaluate. Perhaps tell us what that is to get more help. –  wxffles Aug 14 '12 at 2:19
    
Mel, welcome to this site. Perhaps a recommendation is in order: when you post a question, remain on line caring it and answering comments for an hour or so, as many potential fellow users are going to read it and try answering in that time span. If you just go away after posting your question, it is like showing an "I don't care much" attitude. –  belisarius Aug 14 '12 at 2:29
2  
@acl It's called the pity upvote phenomenon. It has been observed a lot on Stack Overflow (see this discussion). In essence, someone sees a -1 and upvotes it, not because it deserved the upvote, but because they felt bad for the OP. The conclusion was that it was not a problem on Stack Overflow, but on smaller sites like ours, it might well be. –  rm -rf Aug 14 '12 at 17:49
show 2 more comments

1 Answer 1

up vote 1 down vote accepted

For nested spherical shells you will need to supply multiple radius values in a list. I think you want something like this (using Range to create the list of radii):

Manipulate[
 SphericalPlot3D[
  Evaluate@Range[0, rmax, 0.25], {\[Theta], 0, theta \[Pi]}, {\[Phi], 
   0, phi \[Pi]}, SphericalRegion -> True, PlotRange -> 4, Mesh -> 2, 
  Ticks -> None], {theta, 0.07, 1}, {phi, 0.07, 2}, {rmax, 0.07, 4}]

enter image description here

For a proper solid, RegionPlot3D will give good results, but it is rather slow.

RegionPlot3D[
 Sqrt[x^2 + y^2 + z^2] < 0.5 && 
  ArcCos[z/Sqrt[x^2 + y^2 + z^2]] < 2.4 && ArcTan[x, y] < 1.8, 
  {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotRange -> 0.55, PlotPoints -> 200, 
 Mesh -> False]

enter image description here

share|improve this answer
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.