11
$\begingroup$

Consider:

Sin[Pi/5]

which returns: $$\sqrt{\frac58-\frac{\sqrt5}{8}}$$

Does anyone know how to figure out the trigonometric identities used by Mathematica to produce this answer?

I gave this a try:

WolframAlpha["sin(pi/5)"]

but it did not provide any steps.

$\endgroup$
  • 1
    $\begingroup$ How Mathematica itself calculates it is only known to its developers. How one might calculate it with pen and paper belongs on Math.SE, I think. $\endgroup$ – Szabolcs Jan 16 '16 at 16:39
  • 7
    $\begingroup$ Have a look here $\endgroup$ – Simon Woods Jan 16 '16 at 16:46
  • 1
    $\begingroup$ According to Goldstine, Ptolemy started with Sin[Pi/5] and Sin[Pi/3] when constructing his "table of chords," probably from Eu. XIII.10. $\endgroup$ – Michael E2 Jan 16 '16 at 17:13
  • $\begingroup$ See also http://functions.wolfram.com/ $\endgroup$ – user9660 Jan 16 '16 at 17:34
  • $\begingroup$ @Szabolcs I don't think you need to be a developer to guess that it works by a simple lookup. $\endgroup$ – Mark McClure Jan 18 '16 at 20:32
15
$\begingroup$

In the course of answering this question, I ran into a little bit of weirdness that doesn't square with my experience with previous versions of Mathematica. I think writing this answer is as good a time as any to bring it up.

Firstly, there is this tantalizing line from the internal implementation notes:

FunctionExpand uses an extension of Gauss's algorithm to expand trigonometric functions with arguments that are rational multiples of $\pi$.

Indeed, in the old versions of Mathematica, FunctionExpand[] certainly was able to convert trigonometric values at rational multiples of $\pi$ to the corresponding radical values (possibly involving complex numbers). This hinged on the function Developer`TrigToRadicals[], and in fact one could use this directly instead of FunctionExpand[].

Now, however, FunctionExpand[] no longer seems to perform this conversion. Using Developer`TrigToRadicals[] throws an error message saying that it is obsolete, and that one should now use ToRadicals[] instead. The kicker is that ToRadicals[] and Developer`TrigToRadicals[] return different-looking (but numerically equivalent) results, which means the internal algorithms have been changed somewhat.

Quite a mystery.


Now, "Gauss's algorithm" is not terribly informative, considering that Gauss was a rather prodigious producer of mathematical results. However, there is a section in Gauss's Disquisitiones Arithmeticae (sorry, I couldn't find a free English translation) that relates to a number-theoretic view of the roots of unity (and thus, trigonometric functions). In particular, he outlines in one section a recursive method for determining explicit radical expressions of roots of unity.

There is, however, a more modern method that improves on the asymptotic complexity of Gauss's algorithm. In this paper, A. Weber presents an improvement of Gauss's original algorithm that hinges on an efficient way to evaluate the "recursive step" in the original method. A Maple implementation of this improved method is presented in the paper; I will wager that this method, with possibly a few proprietary extensions, is the guts behind Developer`TrigToRadicals[]. (It should be noted that Weber's paper also points to alternative algorithms for explicitly producing radical expressions; I have not been able to find those references, so I cannot say much about them. Maybe an expert can chime in.)

As for the original question, although $\sin(\pi/5)$ is automatically converted to a radical result in the current version of Mathematica, it is likely that the improved Gauss algorithm was used to produce the radical expression in the first place.

$\endgroup$
  • $\begingroup$ ToRadicals[Cos[Pi/257]] fails to give the correct answer. Developer`TrigToRadicals is slower, but is correct. $\endgroup$ – navigaid Jan 13 '17 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.