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'm sorry if this question was answered but I am completely new to Mathematica, really learning as I go (background in Java). The questions I looked at that were suggested didn't make much sense with all the advanced parts being thrown around.

For a Pre Calculus class I need to graph parametric equations. However, one of the questions is:

x = 2t
y = t + 5

with -2 ≤ t ≤ 3.

How would I do this? So far I know the basic equation but I don't get the part with having the piecewise

ParametricPlot[{ 2 t, t + 5}, {t, -10, 10}]
share|improve this question

closed as off-topic by ubpdqn, bobthechemist, Öskå, Michael E2, Silvia Jul 12 '14 at 19:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – ubpdqn, bobthechemist, Öskå, Michael E2, Silvia
If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

f = Piecewise[{{{2 t, t + 4}, -10 < t < -2}, {{2 t, t + 5}, -2 < t < 
  3}, {{2 t, t + 6}, 3 < t < 10}}]
ParametricPlot[f, {t, -10, 10}]

enter image description here

share|improve this answer
Thank you sir/madam :) –  UnwiseOne Jul 12 '14 at 3:48

You have a syntax error in your code: the last comma in the first argument should be deleted. With respect to your question: it depends on what you want to do.

You can simply plot with limited domain [-2,3]:

ParametricPlot[{2 t, t + 5}, {t, -2, 3}]

Or define on $(-\infty,\infty)$, for example (somewhat over kill) but producing the same line segment:

pw[t_] := 
 Piecewise[{{{2 t , t + 5}, -2 <= t <= 3}, {{6, 8}, t > 3}, {{-4, 3}, 
    t < -2}}]
ParametricPlot[pw[t], {t, -10, 10}]

Or define however you wish for t outside [-2,3].

share|improve this answer
Thank you as well, I'm tinkering with Piecewise to understand how to use it in other applications. –  UnwiseOne Jul 12 '14 at 3:58

Another alternative may be something like this:

ParametricPlot[{2 t, t + 5}, {t, -2, 3},RegionFunction -> Function[{t}, -2 <= t <= 3]]
share|improve this answer
I don't see the value of introducing RegionFunction in your answer. Restricting the domain of t to {-2, 3} does the job. –  m_goldberg Jul 12 '14 at 13:16

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