# Rewrite a variable in terms of another variable

I have two variables

  t = 1/Sqrt[2] (Sqrt[1 + Cos[a]] + Sqrt[1 - Cos[a]] +
Sqrt[1 + Cos[b]] + Sqrt[1 - Cos[b]] + Sqrt[1 + Cos[c]] +
Sqrt[1 - Cos[c]])


and

p = 1/2 (1 + Sqrt[3 + 2 (Cos[a] + Cos[b] + Cos[c])]/3)


I need to write p in terms of t. How do I do it?

EDIT

p[a_, b_, c_] :=
Sqrt[3 + 2 (Cos[a] + Cos[b] + Cos[c])] -
Sqrt[3 + 2 (Cos[a] - Cos[b] - Cos[c])] +
Sqrt[3 + 2 (-Cos[a] - Cos[b] + Cos[c])] -
Sqrt[3 + 2 (-Cos[a] + Cos[b] - Cos[c])];
t[a_, b_, c_] :=
1/2 (1 + Sqrt[3 + 2 (Cos[a] + Cos[b] + Cos[c])]/3);
g = {};

n = 1;
While[n < 10000, a = RandomReal[{0, Pi/2}];
b = RandomReal[{0, Pi/2}];
c = RandomReal[{0, Pi/2}];
pra = p[a, b, c];
tra = t[a, b, c];
AppendTo[g, {pra, tra}]; n++];
ListPlot[g]


I have redefined the functions p and t. Now, I need to impose an additional constraint on c; that it falls between Abs[a - b] and  a + b. How do I do it?

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Sep 26, 2021 at 9:56
• You have 2 functions of 3 variables: t[a,b,c] and p[a,b,c]. In general, you can not write t in terms of only t: p[t]. However, what you may try to do is to write p in terms of e.g. t,b,c: p[t,b,c]. But note that this will change the definition region. Sep 26, 2021 at 13:04

Given

p = 1/Sqrt[2] (Sqrt[1 + Cos[a]] + Sqrt[1 - Cos[a]] +
Sqrt[1 + Cos[b]] + Sqrt[1 - Cos[b]] + Sqrt[1 + Cos[c]] +
Sqrt[1 - Cos[c]]);

t = 1/2 (1 + Sqrt[3 + 2 (Cos[a] + Cos[b] + Cos[c])]/3);


We assign random values to the 3 variables a, b and c

val := Block[{a = RandomReal[{0, 2 π}],
b = RandomReal[{0, 2 π}], c = RandomReal[{0, 2 π}]}, {p, t}]


Examining a plot of these

ListPlot[Table[val, 1000]]


it seems unlikely that there is a simple functional relationship between t and p.

• What if the angles are between 0 and Pi/2 and Mod[a-b]<=c<=a+b? Sep 27, 2021 at 14:58
• Why not try it and report the results? Sep 27, 2021 at 17:44
• I have edited the question Sep 27, 2021 at 18:49
• Please don't change the question after it has received answers. In this case, the answer you seek is simply derived from the answer given. Sep 27, 2021 at 20:05