Angle Units For Trig Functions

Liste des GroupesRevenir à cl fortran 
Sujet : Angle Units For Trig Functions
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.fortran
Date : 20. Oct 2024, 04:47:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vf1ug0$8qpm$1@dont-email.me>
User-Agent : Pan/0.160 (Toresk; )
I see that the Fortran 2023 spec has added a bunch of parallel trig
functions that work in degrees.

I find this sort of thing unnecessary. It seems conventional to add
functions for converting between degrees and radians, but a simpler way is
to simply define a conversion factor for each angle unit. One conversion
factor is simpler than two functions for each angle unit.

So trig functions always work in radians. Supposing we have

    real, parameter :: DEG = PI / 180
    real, parameter :: CIRCLE = 2 * PI
    real, parameter :: RAD = 1

Then

    sin(x) -- sin of x in radians
    sin(x * DEG) -- x is in degrees
    atan2(y, x) -- arctangent is in radians
    atan2(y, x) / DEG -- arctangent is in degrees

and we can furthermore have equivalences like

    sin(90 * DEG) = sin(0.25 * CIRCLE) = sin(PI / 2)

(to within rounding error, of course)

and it is easy enough to add other units, e.g.

    real, parameter :: GRAD = PI / 200

Anybody remember those?

Date Sujet#  Auteur
20 Oct 24 * Angle Units For Trig Functions26Lawrence D'Oliveiro
20 Oct 24 +- Re: Angle Units For Trig Functions1yeti
20 Oct 24 `* Re: Angle Units For Trig Functions24Steven G. Kargl
22 Oct 24  `* Re: Angle Units For Trig Functions23Lawrence D'Oliveiro
22 Oct 24   +* Re: Angle Units For Trig Functions5Steven G. Kargl
22 Oct 24   i`* Re: Angle Units For Trig Functions4Lawrence D'Oliveiro
23 Oct 24   i `* Re: Angle Units For Trig Functions3Steven G. Kargl
23 Oct 24   i  `* Re: Angle Units For Trig Functions2Lawrence D'Oliveiro
23 Oct 24   i   `- Re: Angle Units For Trig Functions1Steven G. Kargl
23 Oct 24   `* Re: Angle Units For Trig Functions17Lawrence D'Oliveiro
23 Oct 24    `* Re: Angle Units For Trig Functions16David Jones
23 Oct 24     `* Re: Angle Units For Trig Functions15Lawrence D'Oliveiro
23 Oct 24      `* Re: Angle Units For Trig Functions14R Daneel Olivaw
23 Oct 24       `* Re: Angle Units For Trig Functions13Lawrence D'Oliveiro
23 Oct 24        `* Re: Angle Units For Trig Functions12Steven G. Kargl
23 Oct 24         `* Re: Angle Units For Trig Functions11Neil
24 Oct 24          +- Re: Angle Units For Trig Functions1Steven G. Kargl
24 Oct 24          +* Re: Angle Units For Trig Functions8Lawrence D'Oliveiro
24 Oct 24          i+* Re: Angle Units For Trig Functions6Steven G. Kargl
24 Oct 24          ii`* Re: Angle Units For Trig Functions5Lawrence D'Oliveiro
24 Oct 24          ii `* Re: Angle Units For Trig Functions4Steven G. Kargl
24 Oct 24          ii  `* Re: Angle Units For Trig Functions3Lawrence D'Oliveiro
24 Oct 24          ii   `* Re: Angle Units For Trig Functions2Steven G. Kargl
24 Oct 24          ii    `- Re: Angle Units For Trig Functions1Lawrence D'Oliveiro
24 Oct 24          i`- Re: Angle Units For Trig Functions1Lawrence D'Oliveiro
24 Oct 24          `- Re: Angle Units For Trig Functions1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal