Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

3 deleted 12 characters in body

Simple example:

k = 5;
list = {};
For[i = 1, i <= k - 2,
AppendTo[list, 1/(1 + Cos[(iCos[i \[Pi])Pi/k])];
i = i + 2];
Print[list];

{1/(1+1/4 (1+Sqrt[5])),1/(1+1/4 (1-Sqrt[5]))}


I want the expression to be kept and printed as:

{1/(1 + Cos[(\[Pi])Cos[Pi/5]), 1/(1 + Cos[(3Cos[3 \[Pi])Pi/5])}


I have tried Hold and its several versions, but nothing seems to do the trick.

Simple example:

k = 5;
list = {};
For[i = 1, i <= k - 2,
AppendTo[list, 1/(1 + Cos[(i \[Pi])/k])];
i = i + 2];
Print[list];

{1/(1+1/4 (1+Sqrt[5])),1/(1+1/4 (1-Sqrt[5]))}


I want the expression to be kept and printed as:

{1/(1 + Cos[(\[Pi])/5]), 1/(1 + Cos[(3 \[Pi])/5])}


I have tried Hold and its several versions, but nothing seems to do the trick.

Simple example:

k = 5;
list = {};
For[i = 1, i <= k - 2,
AppendTo[list, 1/(1 + Cos[i Pi/k])];
i = i + 2];
Print[list];

{1/(1+1/4 (1+Sqrt[5])),1/(1+1/4 (1-Sqrt[5]))}


I want the expression to be kept and printed as:

{1/(1 + Cos[Pi/5]), 1/(1 + Cos[3 Pi/5])}


I have tried Hold and its several versions, but nothing seems to do the trick.

2 edited body

Simple example:

k = 5;
list = {};
For[i = 1, i <= k - 2,
AppendTo[list, 1/(1 + Cos[(i \[Pi])/k])];
i = i + 2];
Print[list];

{1/(1+1/4 (1+Sqrt[5])),1/(1+1/4 (1-Sqrt[5]))}


I want the expression to be kept and printed as:

{1/(1 + Cos[(\[Pi])/5]), 1/(1 + Cos[(23 \[Pi])/5])}


I have tried Hold[]Hold and its several versions, but nothing seems to do the trick.

Simple example:

k = 5;
list = {};
For[i = 1, i <= k - 2,
AppendTo[list, 1/(1 + Cos[(i \[Pi])/k])];
i = i + 2];
Print[list];

{1/(1+1/4 (1+Sqrt[5])),1/(1+1/4 (1-Sqrt[5]))}


I want the expression to be kept and printed as:

{1/(1 + Cos[(\[Pi])/5]), 1/(1 + Cos[(2 \[Pi])/5])}


I have tried Hold[] and its several versions, but nothing seems to do the trick.

Simple example:

k = 5;
list = {};
For[i = 1, i <= k - 2,
AppendTo[list, 1/(1 + Cos[(i \[Pi])/k])];
i = i + 2];
Print[list];

{1/(1+1/4 (1+Sqrt[5])),1/(1+1/4 (1-Sqrt[5]))}


I want the expression to be kept and printed as:

{1/(1 + Cos[(\[Pi])/5]), 1/(1 + Cos[(3 \[Pi])/5])}


I have tried Hold and its several versions, but nothing seems to do the trick.

1

# How can I prevent Mathematica from evaluating or "simplifying" an expression?

Simple example:

k = 5;
list = {};
For[i = 1, i <= k - 2,
AppendTo[list, 1/(1 + Cos[(i \[Pi])/k])];
i = i + 2];
Print[list];

{1/(1+1/4 (1+Sqrt[5])),1/(1+1/4 (1-Sqrt[5]))}


I want the expression to be kept and printed as:

{1/(1 + Cos[(\[Pi])/5]), 1/(1 + Cos[(2 \[Pi])/5])}


I have tried Hold[] and its several versions, but nothing seems to do the trick.