Anyone could explain to me which problem is? after running the function "Table" combining with "If" as below, but the result is not a value instead.
k:=8; n:=k+1; Alpha:=Pi/6; r:=3;
In[5]:= Subscript[y, n][i_] := r cos[i \[Alpha]]
In[6]:= Subscript[y, n] =
Table[if [i == 1, Subscript[y, n][0], Subscript[y, n][i]], {i, 1, n}]
Out[6]= {if[True, 3 cos[0], 3 cos[\[Pi]/6]],
if[False, 3 cos[0], 3 cos[\[Pi]/3]],
if[False, 3 cos[0], 3 cos[\[Pi]/2]],
if[False, 3 cos[0], 3 cos[(2 \[Pi])/3]],
if[False, 3 cos[0], 3 cos[(5 \[Pi])/6]],
if[False, 3 cos[0], 3 cos[\[Pi]]],
if[False, 3 cos[0], 3 cos[(7 \[Pi])/6]],
if[False, 3 cos[0], 3 cos[(4 \[Pi])/3]],
if[False, 3 cos[0], 3 cos[(3 \[Pi])/2]]}
Cos
and the imaginary unit isI
. When you define constants, you don't need to useSetDelayed
(:=
); useSet
(=
) instead (see this FAQ). $\endgroup$