[Python-ideas] Fwd: Trigonometry in degrees

Stephan Houben stephanh42 at gmail.com
Mon Jun 11 14:04:31 EDT 2018

2018-06-11 19:33 GMT+02:00 Michael Selik <mike at selik.org>:

> Whoops, it turns out Euler's formula does work! I expected imprecision,
> but at least one test matched.
> x = 42
> cos(x) + 1j * sin(x) == e ** (1j * x)

I think you will find it holds for any x (except inf, -inf and nan).
The boat is less leaky than you think; IEEE floating-point arithmetic goes
out of its way to produce exact answers whenever possible.
(To great consternation of hardware designers who felt that
requiring 1.0*x == x was too expensive.)

> I suppose that's because it's radians.

Well, the formula obviously only holds in exact arithmetic
if cos and sin are the versions taking radians.


> On Mon, Jun 11, 2018, 10:24 AM Michael Selik <mike at selik.org> wrote:
>> Would sind and cosd make Euler's formula work correctly?
>> sind(x) + i * sind(x) == math.e ** (i * x)
>> I suspect that adding these functions is kind of like those cartoons
>> where the boat is springing leaks and the character tried to plug them with
>> their fingers. Floating point is a leaky abstraction.
>> Perhaps you'd prefer an enhancement to the fractions module that provides
>> real (not float) math?
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180611/5c6ae9cb/attachment.html>

More information about the Python-ideas mailing list