## #14 Halfangle limitation

closed
nobody
5
2009-01-04
2002-01-18
Cliff Yapp
No

Setting HALFANGLES gives sin(x/2) =&gt; sqrt(1-cos(x))/2.
Of course, this is wrong if x is negative. Need to
make it smarter.

## Discussion

• Raymond Toy
2002-06-26

Logged In: YES
user_id=28849

What are you expecting?

I think it would be fairly easy for maxima to say

sign(x)*sqrt(1-cos(x))/2

(assuming I got that right.)

See halfangleaux in logarc.lisp.

• Cliff Yapp
2002-06-26

Logged In: YES
user_id=11463

Unfortunately, I wasn't the original person to speak on this
one - I just submitted it from the list, and I can't
remember who it was. If you think the current behavior is
OK then it probably isn't worth fussing with too much.

CY

• Raymond Toy
2002-06-27

Logged In: YES
user_id=28849

What are you expecting?

I think it would be fairly easy for maxima to say

sign(x)*sqrt(1-cos(x))/2

(assuming I got that right.)

See halfangleaux in logarc.lisp.

• Logged In: YES
user_id=588346

The proposed correction,

sign(x)*sqrt(1-cos(x)) / sqrt(2)

only extends the validity of the formula from [0,2pi] to [-
2pi,2pi]. It continues to be incorrect whenever fix(x/(2*pi)) is
odd. I suppose you could use

(-1)^entier(x/(2*pi)) * sqrt(1-cos(x))/sqrt(2)

but I'm not sure that is terribly useful, especially since
Maxima knows nothing about Entier except how to evaluate it
for constants. For example, (-1)^(2*Entier(...)) should simplify
to 1, but doesn't. Entier(Entier(x)) should simplify to Entier
(x). Entier(x+5) should simplify to Entier(x)+5. Etc.

• Robert Dodier
2006-03-26

Logged In: YES
user_id=501686

For the record, (halfangles : true, sin (x/2)); =>
sqrt(1-cos(x))/sqrt(2)\$
i.e., same behavior as when this report was first made.

Recently (Maxima 5.9.3) floor and ceiling have been
implemented as simplifying functions, and the
simplifications for entier mentioned below are all implemented.
(-1)^(2*floor(x)) => 1
floor(floor(x)) => floor(x)
floor(x + 5) => floor(x) + 5

Perhaps this means it is now reasonable to change the
half-angle simplification to (-1)^floor(x/(2*%pi)) * <whatever>.

• Robert Dodier
2006-03-26

• labels: --> 460522

• Robert Dodier
2006-08-27

• labels: 460522 --> Lisp Core - Trigonometry

• Dieter Kaiser
2009-01-04

• status: open --> closed

• Dieter Kaiser
2009-01-04

As suggested on the mailing list the general factors in terms of the floor, round and unit_step function for the functions sin, cos, sinh and cosh are implemented (Revision 1.8 of logarc.lisp). The general factor take into accunt real and complex arguments and simplifies to correct expressions.

Closing the bug report as fixed.

Dieter Kaiser