# not valid variable error

I am new to mathematica and I am having this issue in this piece of code.

x=0.1Sin[[Pi]/8t+[Pi]/4] (* this is my original function*)
v=D[x,t] (* took the 1st derivative and got 0.0392699Cos[pi/4+pi/8t)


Once I got the expression for the 1st derivative, I solved for the equation and got (-6,2) as a solution. The problem starts when I take derivative of v to get an expression for acceleration. a=D[v,t] The above code gives me -6 is not valid variable error. Any kind of help would be greatly appreciated. FWIW,I am doing this in mathematica online.

Here is one way to be explicit about what is a variable and what is a function:

Clear[x,v]
x[t_] := 0.1 Sin[Pi/8 t + Pi/4];
v[t_] = D[x[t], t]


Now you can get the acceleration by:

D[v[t], t]

• thank you for the reply. took your advice and defined my functions, everything was good up until acceleration. It either gives me 0 or some kind of pattern error. Is there something I am missing? – Isaac Ayele Sep 6 '18 at 17:23
• When I type D[v[t], t], I get -0.0154213 Sin[[Pi]/4 + ([Pi] t)/8]. If you are getting something different, restart the kernel (Evaluation->Quit Kernel->Local). – bill s Sep 6 '18 at 17:46
• this is a little strange. I can reproduce the solution whenever I skip using the print function for the two solution I got. When I use the print function, Print["(c)solution=", {t = -6, 2} "s"]; as soon as I add the print function I get the error message. Is there a better way to print the two solutions? – Isaac Ayele Sep 7 '18 at 13:55
• I guess you must be using Print incorrectly. But why Print anything? Why not just look at or list the values you want? – bill s Sep 7 '18 at 14:17
• because the prof. wants us to use the Print function to display our answers. This seems to be working for now, print["(c) Solution= ", Solution]. Thank you for all your help. – Isaac Ayele Sep 7 '18 at 14:32