-1
$\begingroup$

I am very new to Mathematica and I am having an issue with plots not displaying. i am using Mathematica 10 student edition. As per a previous post, I restarted the kernel, but that didn't seem to help.

{x, y, z} = Range[3];
f[x_, y_] := y^2 - 2 x + 4 sin (3 x + 2 y);
G1 = 
  Plot3D[f[x, y], {x, -10, 10}, {y, -10, 20}, 
    AxesLabel -> {"x", "y", "z"}, PlotRange -> {-5, 20}]

only displays an empty box.

C1 = ParametricPlot3D[{x, 1, f[x, 2]}, {x, -2, 1}, AxesLabel -> {x, y, z}]

also displays an empty box and there are others, but

TLine = 
   ParametricPlot3D[{2, 1, 4 Cos[8] - 3} + t {2, 1, 2 + Cos[8]}, 
     {t, -2, 2}, 
     AxesLabel -> {x, y, z}]

displays correctly. Is there a command im not using or not using incorrectly?

$\endgroup$
  • $\begingroup$ Please do not label questions about plotting with the tag graphs-and-networks. That tag is reserved for questions concerning graph theory. In the Mathematica world, what you think of a graphs are called plots (and the functions provided all have Plot in their name) to distinguish them from graphs which are nodes connected by lines (i.e., networks). $\endgroup$ – m_goldberg Oct 1 '15 at 2:58
  • $\begingroup$ Also, see Why do I get an empty plot? $\endgroup$ – Simon Rochester Oct 1 '15 at 7:02
4
$\begingroup$

Double-check your syntax: sin needs to be Sin and the parentheses need to be square brackets in your definition of f. You don't need the first line ({x, y, z} = Range[3];).

The notebook interface has color coding which can help avoid errors like these. Defined symbols (Sin) are black, while undefined symbols are blue (sin), although you perhaps had sin defined elsewhere.

$\endgroup$
  • $\begingroup$ @m_goldberg Intended to comment the question? $\endgroup$ – IPoiler Oct 1 '15 at 2:55
  • $\begingroup$ @IPoiler. Right. Thanks for pointing out my mistake. $\endgroup$ – m_goldberg Oct 1 '15 at 2:57
  • $\begingroup$ @m_goldberg Sorry. Didn't mean to seem pedantic, just wanted to make sure the intended inbox got the delivery. $\endgroup$ – IPoiler Oct 1 '15 at 3:02
  • $\begingroup$ @IPoiler. Wasn't being sarcastic. Really glad you pointed it out. I moved the comment to where it really should go. $\endgroup$ – m_goldberg Oct 1 '15 at 3:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.