0
$\begingroup$

I am trying to figure out how to do the following exercise in Mathematica

Graph $y(t)= a \cos t + b \sin t - 0.5 \sin t$ on the interval $0 ≤ t ≤ 6\, π$

$\endgroup$

closed as off-topic by MarcoB, José Antonio Díaz Navas, Henrik Schumacher, Bob Hanlon, zhk Apr 26 '18 at 7:47

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." – MarcoB, José Antonio Díaz Navas, Henrik Schumacher, Bob Hanlon, zhk
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ Manipulate[ Plot[a Cos[t] + b Sin[t] - 0.5 Sin[t], {t, 0, 6 Pi}, PlotRange -> {-3, 3}], {{a, 0}, -2, 2}, {{b, 0}, -1, 1} ] $\endgroup$ – Henrik Schumacher Apr 25 '18 at 21:23
3
$\begingroup$

The Plot function needs to have numeric values for a and b. The With function is a good way to supply them. Like so.

With[{a = -1., b = 2.},
  Plot[a Cos[t] + b Sin[t] - 0.5 Sin[t], {t, 0, 6 π},
    Ticks -> {Subdivide[0, 6 π, 6], Automatic},
    PlotRange -> All]] 

plot

$\endgroup$
  • $\begingroup$ @HighPerformanceMark, @Rabbit. 'fiction` should of course be 'function'. My system's intrusive spelling corrector "fixed" a mis-typing for me and I didn't notice it. Thanks for bringing my attention to it. $\endgroup$ – m_goldberg Apr 26 '18 at 18:36
2
$\begingroup$

You already got an answer. But here is another way to plot your function.

Define a function in Mathematica way,

 f[a_, b_, t_] := a Cos[t] + b Sin[t] - 0.5 Sin[t]

and then plot it assigning values to the parameters,

Plot[f[1, 1, t], {t, 0, 6 \[Pi]}]
$\endgroup$

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