Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Greg Ewing
Steven D'Aprano wrote: Even old-school scientific calcuators without the fancy CAS symbolic maths are capable of having cos(90) return zero in degree mode. FWIW, my Casio fx-100 (over 30 years old) produces exactly 1 for both sin(90°) and sin(pi/2) for its version of pi. -- Greg _

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Greg Ewing
Chris Angelico wrote: The math module would need a hyperbolic sine function which accepts an argument in; Except that the argument to hyperbolic trig functions is not an angle in any normal sense of the word, so expressing it in degrees makes little sense. (However I do like the idea of a func

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Greg Ewing
Stephen J. Turnbull wrote: Since Pi is irrational, Pi/4 is too, so it definitely cannot be represented. Making a correction to a number that "looks like" Pi/4 is against this philosophy. I'm not sure what all the fuss is about: >>> from math import pi, sin >>> sin(pi/2) 1.0 >>> sin(pi/2 + 2 *

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Steven D'Aprano
On Fri, Jun 08, 2018 at 02:37:33PM +0900, Stephen J. Turnbull wrote: > My bias is that people who want to program this kind of thing just > need to learn about floating point numbers and be aware that they're > going to have to accept that > > >>> from math import cos, radians > >>> cos(radians(9

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Steven D'Aprano
On Thu, Jun 07, 2018 at 10:39:06PM -0400, Richard Damon wrote: > First I feel the need to point out that radians are actually fairly > fundamental in trigonometry, so there is good reasons for the base > functions to be based on radians. The fact that the arc length of the > angle on the unit circ

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Chris Angelico
On Fri, Jun 8, 2018 at 3:45 PM, Steven D'Aprano wrote: > Although personally I prefer the look of d as a prefix: > > dsin, dcos, dtan > > That's more obviously pronounced "d(egrees) sin" etc rather than "sined" > "tanned" etc. Having it as a suffix does have one advantage. The math module would n

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Steven D'Aprano
On Fri, Jun 08, 2018 at 08:17:02AM +1000, Hugh Fisher wrote: > But I think that the use of > radians in programming language APIs is more prevalent, so the initial > advantage > of easy learning will be outweighed by the long term inconvenience of > adjusting to what everyone else is doing. But

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Yuval Greenfield
On Thu, Jun 7, 2018 at 10:38 PM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > > 6.123233995736766e-17 > >>> > > is good enough for government work, including at the local public high > school. > > There probably is room for a library like "fractions" that represents multiples

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Stephen J. Turnbull
Richard Damon writes: > To make it so that sindeg/cosdeg of multiples of 90 come out exact is > probably easiest to do by doing the angle reduction in degrees (so the > nice precise angles stay as nice precise angles) and then either adjust > the final computation formulas for degrees, or conv

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Greg Ewing
Richard Damon wrote: First I feel the need to point out that radians are actually fairly fundamental in trigonometry, Even more so in calculus, since the derivative of sin(x) is cos(x) if and only if x is in radians. -- Greg ___ Python-ideas mailing

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Richard Damon
On 6/7/18 7:08 PM, Robert Vanden Eynde wrote: > - I didn't know there were sinf in C (that's since C99), I was aware > of the 'd' postfix in opengl. > > So yeah, sind would be a bad idea, but sindeg or degsin would be too > long, hmm, and I can settle for the Pre or Post fix. sindeg(90) > degsin(90

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Robert Vanden Eynde
- I didn't know there were sinf in C (that's since C99), I was aware of the 'd' postfix in opengl. So yeah, sind would be a bad idea, but sindeg or degsin would be too long, hmm, and I can settle for the Pre or Post fix. sindeg(90) degsin(90) are both pretty, the first emphasize on the "degree" pa

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Hugh Fisher
> Date: Thu, 7 Jun 2018 12:33:29 + > From: Robert Vanden Eynde > To: python-ideas > Subject: [Python-ideas] Trigonometry in degrees > Message-ID: > > > I suggest adding degrees version of the trigonometric functions in the math > module. > > - Useful in Teaching and replacing calcula

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Yuval Greenfield
On Thu, Jun 7, 2018 at 1:07 PM Robert Vanden Eynde < robertvandeney...@hotmail.com> wrote: > I suggest adding degrees version of the trigonometric functions in the > math module. > > You can create a pypi package that suits your needs. If it becomes popular it could considered for inclusion in the

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Rob Speer
You meant math.radians(degrees), and Robert already mentioned the problem with this: >>> math.cos(math.radians(90)) 6.123233995736766e-17 On Thu, 7 Jun 2018 at 16:22 Ryan Gonzalez wrote: > You could always do e.g. math.sin(math.degress(radians)) and so forth... > > On June 7, 2018 3:07:21 PM Ro

Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Ryan Gonzalez
You could always do e.g. math.sin(math.degress(radians)) and so forth... On June 7, 2018 3:07:21 PM Robert Vanden Eynde wrote: I suggest adding degrees version of the trigonometric functions in the math module. - Useful in Teaching and replacing calculators by python, importing something

[Python-ideas] Trigonometry in degrees

2018-06-07 Thread Robert Vanden Eynde
I suggest adding degrees version of the trigonometric functions in the math module. - Useful in Teaching and replacing calculators by python, importing something is seen by the young students much more easy than to define a function. - Special values could be treated, aka when the angle is a mu

Re: [Python-ideas] datetime.timedelta literals

2018-06-07 Thread Pål Grønås Drange
For closure, I've added a package, timeliterals (env) [pgdr@hostname ~]$ pip install timeliterals (env) [pgdr@hostname ~]$ python >>> from timeliterals import * >>> 3*hours datetime.timedelta(0, 10800) >>> 3*minutes datetime.timedelta(0, 180) >>> 3*seconds datetime.timedelta(0, 3) The source code