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

I am trying to sketch an elliptic paraboloid given by z=\frac{x^2}{4}+y^2 using pst-3dplot. I used \parametricplotThreeD to sketch the graph. The trace on the plane z=3 is an ellipse with major axis 4 and minor axis 2. I sketched both the major axis and the minor axis (of that trace) on the same figure. However those two segments do not match the trace. The trace seems to be off in the figure. What am I doing wrong? The following is the code.

\documentclass[12pt]{report}
\usepackage{pst-3dplot}

\begin{document}
\begin{pspicture}(-.25\linewidth,-1)(.25\linewidth,4.5) 
\pstThreeDCoor[xMax=3,yMax=3, zMax=4,IIIDticks]
\pstThreeDLine(2,0,3)(-2,0,3)
\pstThreeDLine(0,1,3)(0,-1,3)
\pstThreeDPut(0,0,2){\psdot}
\parametricplotThreeD[plotstyle=curve,yPlotpoints=20](0,360)(0,1){t cos 2 mul u mul t sin u mul u dup mul 2 mul 2 add}
\end{pspicture}
\end{document}
share|improve this question
    
You should leave the original code and then post the solution, adding a short comment on what the problem was. –  Gonzalo Medina Sep 10 '11 at 1:21
    
@Gonzalo: Did I miss something here? What solution? I don't see any unmatched trace from the given code. This is what my output looks like. Regardless, misalignment might be caused by whitespace in the code. –  Werner Sep 10 '11 at 1:30
    
@Gonzalo The error line was \parametricplotThreeD[plotstyle=curve,yPlotpoints=20](0,360)(0,1){t cos 2 mul u mul t sin u mul u dup mul 2 mul 2 add} The correct line is \parametricplotThreeD[plotstyle=curve,yPlotpoints=20](0,360)(0,1){t cos 2 mul u mul t sin u mul u dup mul 2 add} Sorry for the misunderstanding. I just change the code to reflect the original error. –  Sony Sep 10 '11 at 1:38
add comment

1 Answer

up vote 0 down vote accepted

I chose two parameters, namely t, an angular parameter that varies from 0 to 360 degrees, and u, a radial parameter that varies from 0 to 1, to plot the elliptic paraboloid z-2=\frac{x^2}{4}+y^2.

Then the parametric equations are x=2u\cos t, y=u\sin t and z=u^2+2. (My mistake was setting z=2u^2+2.) I would not have caught the error had I stopped there as there is very little difference (visually) between the two output images. When I tried to plot the major axis and minor axis of the trace on z=3 plane, I realized that something was wrong. Initially, I checked the code and did not find any errors and that was why I posted the question in the first place. However, few minutes after posting, I realized that I did not check my derivations of parametric equations. I apologize to the generous readers of StackExchange. (This is the best site on the Internet.) The correct code is given below.

\documentclass[12pt]{report}
\usepackage{pst-3dplot}

\begin{document}
\begin{pspicture}(-.25\linewidth,-1)(.25\linewidth,4.5) 
\pstThreeDCoor[xMax=3,yMax=3, zMax=4,IIIDticks]
\pstThreeDLine(2,0,3)(-2,0,3)
\pstThreeDLine(0,1,3)(0,-1,3)
\pstThreeDPut(0,0,2){\psdot}
\parametricplotThreeD[plotstyle=curve,yPlotpoints=20](0,360)(0,1){t cos 2 mul u mul t sin u mul u dup mul 2 add}
\end{pspicture}
\end{document}
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.