Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

enhanced ArcCos[] ?

  • To: mathgroup at
  • Subject: [mg24805] enhanced ArcCos[] ?
  • From: Gianluca Gorni <gorni at>
  • Date: Sun, 13 Aug 2000 03:16:43 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Hi Andrzej!

By the way, I didn't send my numeric workaround to the

A few ideas about how to enhance ArcCos[]: here is an
attempt of mine, using numerics as intermediate steps:

myArcCos[x_ /; Element[x, Algebraics]] :=
  Module[{prec = 10^(-5), attempt},
      attempt = Rationalize[ArcCos[x]/Pi // N, prec];
      If[Chop[N[Cos[attempt*Pi] - x]] === 0 &&
          FullSimplify[FunctionExpand[Cos[attempt*Pi]] - x] === 0,

(We need "prec" because of a bug in Rationalize[] in Mathematica 4).

It seems to work for cosines of simple fractions of Pi.
This solution is so cheap that I think wri should do
something about the problem. After all, one of the novelties of
Mathematica 4 (or was it 3?) was FunctionExpand, that gave radicals expressions
for direct trig function. I was disappointed to see that
it does not do the reverse. I think FunctionExpand should
cover inverse trig functions.
Of course an experienced mathematica programmer will find
a workaround if he/she needs it. What I have in mind is
a beginner.

Since all cyclotomic polynomials up to n=104
have +1, 0 and -1 as the only coefficients, a
preliminary easy (?) test for an algebraic number to be
the cosine of a rational multiple of Pi may be something
like this

prelTest[x_ /; Element[x, Algebraics]] :=
  Module[{minPol, coe},
    minPol = RootReduce[x + I*Sqrt[1 - x^2]][[1, 1]];
    coe = CoefficientList[minPol, #1];
    If[Degree[minPol, #1] < 105 &&
         Complement[coe, {1, -1, 0}] =!= {}, False,

I wonder if it would take a long time to develop
these ideas into an enhanced FunctionExpand that gave
sensible inverse trig function results reasonably quickly.

Best regards,

             Gianluca Gorni

  • Prev by Date: Incorrect Fourier Transorms?
  • Next by Date: Re: 3D plot of discontinuous function
  • Previous by thread: Re: Incorrect Fourier Transorms?
  • Next by thread: Custom build for MathLink examples in MS Visual Studio 6.0