Tcl Library Source Code

View Ticket
Login
Ticket UUID: 21fef042b91ca252fc2a20ead5cd05c2b51b1776
Title: add sind ,cosd, etc to geometry functions
Type: Patch Version: 8.5
Submitter: gold Created on: 2017-11-18 23:50:06
Subsystem: math :: geometry Assigned To: arjenmarkus
Priority: 5 Medium Severity: Cosmetic
Status: Closed Last Modified: 2021-03-14 13:33:50
Resolution: Fixed Closed By: arjenmarkus
    Closed on: 2021-03-14 13:33:50
Description:
ticket subject: proposal add sind, cosd, etc to geometry functions.
The proposed 13 trig functions as scalar in degrees are listed below. Recognise these  trig functions (with radian measures) are convertible with your degToRad and radToDeg constants in the TCLLIB, but the usual trigonometric functions with input values as scalar or vector in degrees might be convenient to some TCLLIB users. Maybe these sind and cosd functions are already available in other TCL libraries, but not known to me (from some docs and later textbooks). As noted on the ticket entry, these proposed changes are cosmetic and do not interfere with existing user programs.

math:geometry.
::math::geometry::degToRad angle 
::math::geometry::radToDeg angle

math::geometry(n) 1.2.2 tcllib "Tcl Math Library"
list of proposed 15 trig functions.
sind(x)=Sine of argument in degrees,
 cosd(x)=Cosine of argument in degrees,
 tand(x)=Tangent of argument in degrees, 
cotd(x)=Cotangent of argument in degrees, 
asind(x)=returns the inverse sine (sin-1) of the elements of X in degrees,
 acosd(x)=returns the inverse cosine (cosin-1) of the elements of X in degrees,,
 atand(x)=Inverse tangent in degrees, 
acotd(x)=Inverse cotangent in degrees, 
secd(x)=Secant of argument in degrees,
cscd(x)=Cosecant of argument in degrees,
asecd(x)=Inverse secant in degrees, 
acscd(x)=Inverse cosecant in degrees,
atan2d(x1, x2)=Four-quadrant inverse tangent in degrees
User Comments: arjenmarkus added on 2021-03-14 13:33:50:
This was fixed  already (see comments) - I should have closed the ticket.

anonymous (claiming to be gold) added on 2018-07-25 20:02:49:
to akupries 
subj. are examples needed on wiki or man page?
 
Thank you. This seems really exciting work, which wiil keep TCL in pace with
some of the other brand name (math oriented) languages. However, are examples needed on wiki or TCL/TCLLIB/UNIX man page?

arjenmarkus added on 2018-07-23 06:55:10:
What I forgot to mention is that the implementation of the degrees version of sin, cos, etc. is such that multiples of 90 degrees will result in exact values, that is: sind(180) = 0, cosd(90) = 0, sind(90) = 1.

This is achieved by reducing the angle to an interval -45 to 45 degrees first and keeping track of the quadrant (rotated over 45 degrees) in which the original angle lies. Then converting to radians and applying basic trigonometric formulae.

No such claim of exactness is made for other angles for which one or more of the sine/cosine/... functions yield a rational value.

arjenmarkus added on 2018-07-23 06:49:14:
I have used this to implement a full set of trigonometric functions and their inverses, as well as some additional hyperbolic functions and their inverses. They can be found in the math::trig package in Tcllib's math module.

aku added on 2018-07-09 19:28:33:
Arjen, could you have look at this, please ?

gold added on 2017-11-27 18:42:44:
gold, Possibly related ticket, i am looking in stacks.
Attachment "extrafuncs.tcl" to ticket [641143ffff] added by dkf on 2006-03-16 16:27:34.

Attachments: