# How to get the alternate forms like wolframalpha.com give in Mathematica?

i try to optimize some code getting rid of ArcTan, Atan or extra Cos, Sin calculations

x = Sin[c]
y = Cos[c]
v = Arctan[x,y]/2;
pV = {Sin[v], Cos[v]}


Sin[c] and Cos[c] and pV is needed - the rest could be replace by (maybe) something cheaper, c is Real, pV-signs should remain the same

my idea was to inline the and reduce the dependencies down to sin(c),cos(c) and sqrt

pV = {Sin[v], Cos[v]}


according to https://wikimedia.org/api/rest_v1/media/math/render/svg/174e1931034cc4c35aaedfdb2a3cd06c9247d850 (signature difference: Arctan(x,y) = atan2(y,x))

first condition for example is

 Arctan(x,y)
if x > 0
result = Arctan[y/x]


so for a test i fed wolframalpha with my inline Arctan[Sin[c],Cos[c]]/2 for this first condition

Sin[Atan[Cos[c]/Sin[c]]/2]


and used the "Alternate forms:" to find an Sin[c],Cos[c] only version:

the second page alternate form was

   (cos(c))/(sqrt(2) sqrt(1 + 1/sqrt(1 + (cos^2(c))/(sin^2(c)))) sqrt(1 +
(cos^2(c))/(sin^2(c))) sin(c))


it works and is a litte bit faster then Sin[Atan[Cos[c]/Sin[c]]/2]

question: are the alternative forms of wolframalpha also available in Mathematica or is that a special feature?

and if it is availabe - is it also possible to expand the Arctan conditions (like in my own if using functions)

thx for any help

UPDATE

found a solution for the first part - optimizing away Arctan

in C i can replace

x = Sin[c]
y = Cos[c]
v = Arctan[x,y]/2;


with

v = -remainder(c - M_PI/2, M_PI*2) / 2;

• Have you seen WolframAlpha? E.g. WolframAlpha["Sin[Atan[Cos[c]/Sin[c]]/2]"] Commented Jun 20, 2017 at 18:47
• didn't know WolframAlpha - thx
– llm
Commented Jun 21, 2017 at 4:41