Problem with ParametricPlot3D in Mathematica

  • Mathematica
  • Thread starter Barnak
  • Start date
  • Tags
    Mathematica
In summary, the problem is that ParametricPlot3D does not produce a smooth curve, even when MaxRecursion is set to 5000. Fiddling with the interaction between PlotPoints and MaxRecursion may be able to achieve a smooth curve.
  • #1
Barnak
63
0
I'm having an output quality problem with ParametricPlot3D in Mathematica 7.

I need to show a complicated curve found by numerical integration of a differential equation (using NDSolve), and export the curve's graphic (from ParametricPlot3D) to PDF, so I can use it in another application. I know how to do it, and it's working, but the curve is having a very crude aspect (straight lines, instead of a smooth curve, or some parts of the curve aren't right).

Of course, I could add the option PlotPoints-> 5000 to smooth the curve (4000 or less isn't enough, apparently), but this gives a huge PDF file (about 10 MB for a simple vectorial graphic), and it's useless for what I need to do with it.

The exact same code in Mathematica 4 (which I don't have access anymore) didn't gave me the problem at all : I got a nicely looking curve which could be exported into a small PDF file. So I don't understand what is happening here with Mathematica 7.

Do I need to add some special directives to the ParametricPlot3D, to get an optimised smooth curve, without having to add something like PlotPoints -> 5000 ?
 
Physics news on Phys.org
  • #2
Instead of PlotPoints-> 5000 try MaxRecursion->somenumber, and without your curve I can't even guess where you might start. The default for MaxRecursion is Automatic and it appears that some part of your curve is sufficiently convoluted that it bails out before getting the detail you want.

MaxRecursion should enable it to spend more work on the convoluted parts without needing to have vast numbers of points on the smooth parts. Look up MaxRecursion in the help system and in ParametricPlot3D to get limited information on how this works. Start slowly and see how it behaves as you increment it.

You can also turn on informative messages about it not being able to achieve sufficient smoothness with On[ParametricPlot3d:accbend]. This can give you some idea when it cannot accomplish what it thinks you are asking for.
 
  • #3
Thanks, this may help.

I already used the MaxRecursion option however. It helps in some cases, but not always.
 
  • #4
Barnak said:
I already used the MaxRecursion option however. It helps in some cases, but not always.

Fiddle with the interaction between PlotPoints and MaxRecursion, with the message turned on to see when it believes it cannot find a smooth enough curve and see if you can find an acceptable setting. Choose small specific complicated parts of your curve and watch how those two options interact. PlotPoints should give fixed spacing between the points, no matter how smooth or complicated the curve is at some position. MaxRecursion should enable more or less subdivision between points, more near positions where the curve is complicated.

A completely different approach, I vaguely recall a pdf-optimizer that would eat a large inefficient pdf and emit a very similar appearing but far smaller pdf, but that was many many years ago and I may be incorrect.

Or I suppose you could consider writing code that would generate exactly the curve you desire, based on your knowledge of the curve and the demands you have.
 
  • #5


Thank you for bringing this issue to our attention. It seems that there may be a compatibility issue with ParametricPlot3D in Mathematica 7 and the way it handles curves found through numerical integration. One possible solution could be to try using a different version of Mathematica, such as version 4 which you mentioned had no issues with the same code. Alternatively, you could try adjusting the settings for PlotPoints and MaxRecursion to see if that improves the output quality without significantly increasing the file size. If these options do not work, you may want to reach out to Wolfram Support for further assistance.
 

1. Why is my ParametricPlot3D not working in Mathematica?

There could be several reasons for this. One common issue is incorrect syntax in the parametric function or the plot options. Make sure you have used the correct syntax for the parametric function and have specified all the necessary plot options. Another possibility is that your function or plot range may be too large, causing Mathematica to run out of memory. Try narrowing down your plot range or using the PlotPoints option to control the number of points plotted.

2. How can I change the color or style of my ParametricPlot3D in Mathematica?

To change the color or style of your plot, you can use the ColorFunction or PlotStyle options respectively. For example, you can use the ColorFunction option to specify a color gradient based on a function, or use the PlotStyle option to change the color and style of the plotted surface or curve.

3. How can I add labels or axes to my ParametricPlot3D in Mathematica?

To add labels and axes to your plot, you can use the AxesLabel and Axes options. The AxesLabel option allows you to specify labels for the x, y, and z axes, while the Axes option allows you to turn on or off the axes. You can also use the FrameLabel and Frame options to add labels and frames around the plot.

4. Can I combine multiple ParametricPlot3D plots in Mathematica?

Yes, you can use the Show function to combine multiple plots into one. Simply list the plots you want to combine inside the Show function, and use the PlotRange option to adjust the range of the combined plot. You can also use the PlotLegends option to add a legend to your combined plot.

5. How can I export my ParametricPlot3D from Mathematica to an image file or other format?

To export your plot, you can use the Export function. You can specify the file format and file name in the Export function, and use the ImageSize option to adjust the size and resolution of the exported plot. You can also export your plot as a vector graphics file using the "PDF" or "EPS" format, which allows for high-quality scaling without losing resolution.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
9K
Back
Top