# Syntax question regarding function plotting in Mathematica. [closed]

Y = (Sin[2 [Pi]t]) (1 + (1/5) Sin[6 [Pi]t] + (1/10) Sin[8 [Pi]t])

I'm trying to plot this function in Mathematica, however when I run Plot[Y, {t, -15, 15}] nothing will show up on the graph.

I think the problem is I'm entering the syntax wrong for all the trig functions?

Sorry I'm new to Mathematica. Thank you for any help! Joe

-

## closed as off topic by Cameron Buie, Asaf Karagila, Sasha, Matt Pressland, Alexander Gruber♦Mar 9 '13 at 23:22

Questions on Mathematics Stack Exchange are expected to relate to math within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Thank you @Guest 86, I'll try that. –  Joe Mar 9 '13 at 23:00
Ah I deleted the comment, sorry - I said that Y is evaluated once for some t when it's defined. Y[t_]:= (Sin[2 Pi t]) (1 + (1/5) Sin[6 Pi t] + (1/10) Sin[8 Pi t]) makes it a function which can be used in Plot[Y[x], {x,-15,15}] –  Guest 86 Mar 9 '13 at 23:03
@guest86 In[116]:= Y[t_] := (Sin[ 2 [Pi]t]) (1 + (1/5) Sin[6 [Pi]t] + (1/10) Sin[8 [Pi]t]) During evaluation of In[116]:= SetDelayed::write: Tag Times in (Sin[6.28319 sin^2 x] (1+1/5 Sin[18.8496 sin^2 x]+1/10 Sin[25.1327 sin^2 x]))[t_] is Protected. >> Out[116]= $Failed – Joe Mar 9 '13 at 23:07 If you used copy-paste, there might be some hidden space (Or another char) there, somewhere. Try retyping Y[t_]:= (Sin[2 Pi t]) (1 + (1/5) Sin[6 Pi t] + (1/10) Sin[8 Pi t]) manually. – Guest 86 Mar 9 '13 at 23:15 @guest86 Thanks for all the responses I just retyped it all, no extra spaces or anything and get: In[120]:= Y[t_] := (Sin[ 2 [Pi]t]) (1 + (1/5) Sin[6 [Pi]t] + (1/10) Sin[8 [Pi]t]) During evaluation of In[120]:= SetDelayed::write: Tag Times in (Sin[6.28319 sin^2 x] (1+1/5 Sin[18.8496 sin^2 x]+1/10 Sin[25.1327 sin^2 x]))[t_] is Protected. >> Out[120]=$Failed –  Joe Mar 9 '13 at 23:19

Remove the brackets from around $\pi$ and use parentheses instead (or the times operator *).

So, like this:

In[1]:= Y = (Sin[2 (Pi)t]) (1 + (1/5) Sin[6 (Pi)t] + (1/10) Sin[8 (Pi)t]);

In[2]:= Plot[Y, {t, -15, 15}]

-
Y = (Sin[2*[Pi]*t]) (1 + (1/5) Sin[6*[Pi]*t] + (1/10) Sin[8*[Pi]*t]) Syntax::sntxf: "2*" cannot be followed by "[Pi]*t". Syntax::tsntxi: "[Pi]" is incomplete; more input is needed. Syntax::sntxi: Incomplete expression; more input is needed . –  Joe Mar 9 '13 at 23:04
[] is Mathematica's way of denoting functions. You are confusing the program writing [Pi]. If you need a grouping symbol to visually help you see the code, just use parentheses. –  sasha Mar 9 '13 at 23:11
I'm entering them as esc p esc but when I copy paste them here it changes them to [Pi]. Is the esc p esc method ok? –  Joe Mar 9 '13 at 23:13
@Joe yes that works. \[Pi] is the ASCII form of the Pi symbol. Are you connecting the Pi and the t close together? You need a space between them (\[Pi] t, not \[Pi]t) otherwise Mathematica will interpret the pair as a single symbol/variable. –  amr Mar 9 '13 at 23:16
@Sasha THANK YOU!!!! This was the problem I had from the beginning... I needed a space between the pi and t. –  Joe Mar 9 '13 at 23:31