WP-32S in 2016?
01-12-2016, 12:08 AM (This post was last modified: 01-14-2016 12:21 AM by matthiaspaul.)
Post: #69
 matthiaspaul Senior Member Posts: 385 Joined: Jan 2015
RE: WP-32S in 2016?
(01-08-2016 09:09 PM)Dieter Wrote:  Finally, there are some not too sophisticated functions that can make the programmer's life much easier as they preserve accuracy that would be lost in a straightforward implementation. Think of a sqrt(1+x) – 1 or a general (1+x)^n – 1 function, especially for small x. Or y^x – 1, or 1 – cos x, or Lambert's W + 1. Or a sin(x*pi) function that returns exact results for integer fractions of Pi. Or... you get the idea. There is more than ln(1+x) and e^x–1.
Yes, I agree. I always wondered why these two functions
• lnp1(x) = ln(1+x)
• expm1(x) = e^x-1
were available for base e only, not for some other bases. However, some while back I learnt that the IEEE-754:2008 and ISO/IEC/IEEE 60559:2011 standards now recommend implementations also for base 10 and 2 (the following 4 function names are my own creations in lack of anything "official"):
• lgp1(x) = lg(1+x)
• exp10m1(x) = 10^x-1
• ldp1(x) = ld(1+x)
• exp2m1(x) = 2^x-1
Regarding 1-cos(x), I recommend to implement not just the versine but the whole set of missing trigonometric functions (with q=angle of full circle/4 depending on selected angle mode):

Secant and inverse:
• sec(x) = 1/cos(x)
• asec(x) = acos(1/x)
Cosecant and inverse:
• csc(x) = 1/sin(x)
• acsc(x) = asin(1/x)
Cotangent and inverse:
• cot(x) = 1/tan(x) = cos(x)/sin(x)
• acot(x) = atan(1/x)
Versine and inverse:
• ver(x) (or vsn(x)) = 2*(sin(x/2))^2 = 1-cos(x)
• aver(x) = acos(1-x)
Vercosine and inverse:
• vcs(x) = 2*(cos(x/2))^2 = 1+cos(x)
• avcs(x) = acos(1+x)
Coversine and inverse:
• cvs(x) = ver(q-x) = 1-sin(x)
• acvs(x) = asin(1-x)
Covercosine and inverse:
• cvc(x) = vcs(q-x) = 1+sin(x)
• acvc(x) = asin(1+x)
Haversine and inverse:
• hav(x) = ver(x)/2 = (sin(x/2))^2 = (1-cos(x))/2
• ahav(x) = 2*asin(sqrt(x))
Havercosine and inverse:
• hvc(x) = vcs(x)/2 = (cos(x/2))^2 = (1+cos(x))/2
• ahvc(x) = 2*acos(sqrt(x))
Hacoversine and inverse:
• hcv(x) = cvs(x)/2 = ver(q-x)/2 = hav(q-x) = (1-sin(x))/2
• ahcv(x) = ?
Hacovercosine and inverse:
• hcc(x) = cvc(x)/2 = vcs(q-x)/2 = hvc(q-x) = (1+sin(x))/2
• ahcc(x) = ?
Exsecant and inverse:
• exs(x) = sec(x)-1 = 1/cos(x)-1 = (1-cos(x))/cos(x) = ver(x)/cos(x) = ver(x)*sec(x) = 2*sec(x)*(sin(x/2))^2
• aexs(x) = asec(x+1) = acos(1/(1+x)) = atan(sqrt(x^2+2*x))
Excosecant and inverse:
• exc(x) = exs(q-x) = csc(x)-1 = 1/sin(x)-1 = (1-sin(x))/sin(x) = cvs(x)/sin(x) = cvs(x)*csc(x) = 2*csc(x)*(cos(x/2))^2
• aexc(x) = acsc(x+1) = asin(1/(1+x))
Chord and inverse:
• crd(x) = 2*sin(x/2)
• acrd(x) = 2*asin(x/2)
Sagitta and inverse:
• sag(x) = ver(x/2) = 1-cos(x/2)
• asag(x) = 2*acos(1-x)
Cosagitta and inverse:
• csg(x) = cvs(x/2) = 1-sin(x/2)
• acsg(x) = 2*asin(1-x)
(01-11-2016 07:34 AM)walter b Wrote:  While we're at it, it reminds me of an angular mode I wanted to see implemented in the 43S: multiples of π. We calculate them very precisely anyway, so this mode will come at no extra cost.
Yes, factors of pi definitely has utility value as well (some RPL calcs have a ->Qπ fraction of pi function in addition to the normal ->Q function to convert a number into a fraction), it's quite close to a turns mode.

Nevertheless, if I were forced to select only one of these modes, I would choose turns because it appears to be more universal and is already reasonably well established (although not implemented in calculators so far). Having the angle of a full circle normalized to 1 allows for easier conversions to/from a whole bunch of other angle units (including factors of pi, of course).

By the way, the above mentioned floating-point standards also recommend new variants of trigonometric functions related to factors of pi (@ recommended by IEEE, the others are supported by Oracle).
• sinpi(x) = sin(pi*x) @
• cospi(x) = cos(pi*x) @
• tanpi(x) = tan(pi*x)
• asinpi(x) = asin(x) / pi
• acospi(x) = acos(x) / pi
• atanpi(x) = atan(x) / pi @
• atan2pi(y,x) = atan2(x) / pi @
Greetings,

Matthias

--
"Programs are poems for computers."
 « Next Oldest | Next Newest »

 Messages In This Thread WP-32S in 2016? - Sanjeev Visvanatha - 01-01-2016, 01:41 AM RE: WP-32S in 2016? - Paul Dale - 01-01-2016, 03:14 AM RE: WP-32S in 2016? - Csaba Tizedes - 01-01-2016, 02:14 PM RE: WP-32S in 2016? - walter b - 01-01-2016, 02:36 PM RE: WP-32S in 2016? - Csaba Tizedes - 01-01-2016, 03:26 PM RE: WP-32S in 2016? - walter b - 01-01-2016, 05:47 PM RE: WP-32S in 2016? - Csaba Tizedes - 01-01-2016, 08:20 PM RE: WP-32S in 2016? - walter b - 01-01-2016, 02:19 PM RE: WP-32S in 2016? - rprosperi - 01-01-2016, 03:44 PM RE: WP-32S in 2016? - walter b - 01-01-2016, 05:08 PM RE: WP-32S in 2016? - rprosperi - 01-01-2016, 05:52 PM RE: WP-32S in 2016? - Massimo Gnerucci - 01-01-2016, 07:56 PM RE: WP-32S in 2016? - walter b - 01-02-2016, 07:23 PM RE: WP-32S in 2016? - Sanjeev Visvanatha - 01-02-2016, 04:59 PM RE: WP-32S in 2016? - Luigi Vampa - 01-03-2016, 09:47 PM RE: WP-32S in 2016? - walter b - 01-04-2016, 05:11 PM RE: WP-32S in 2016? - Luigi Vampa - 01-04-2016, 06:25 PM RE: WP-32S in 2016? - walter b - 01-04-2016, 10:42 PM RE: WP-32S in 2016? - rprosperi - 01-05-2016, 03:31 AM RE: WP-32S in 2016? - Didier Lachieze - 01-06-2016, 12:51 PM RE: WP-32S in 2016? - Luigi Vampa - 01-04-2016, 11:43 PM RE: WP-32S in 2016? - walter b - 01-07-2016, 02:54 PM RE: WP-32S in 2016? - Sanjeev Visvanatha - 01-07-2016, 03:40 PM RE: WP-32S in 2016? - walter b - 01-08-2016, 06:20 PM RE: WP-32S in 2016? - walter b - 01-10-2016, 12:50 PM RE: WP-32S in 2016? - Dieter - 01-10-2016, 02:02 PM RE: WP-32S in 2016? - walter b - 01-10-2016, 08:17 PM RE: WP-32S in 2016? - emece67 - 01-10-2016, 03:07 PM RE: WP-32S in 2016? - rprosperi - 01-10-2016, 04:39 PM RE: WP-32S in 2016? - Dieter - 01-10-2016, 07:54 PM RE: WP-32S in 2016? - emece67 - 01-10-2016, 08:15 PM RE: WP-32S in 2016? - Dieter - 01-10-2016, 08:33 PM RE: WP-32S in 2016? - rprosperi - 01-10-2016, 09:21 PM RE: WP-32S in 2016? - emece67 - 01-10-2016, 09:45 PM RE: WP-32S in 2016? - matthiaspaul - 01-11-2016, 12:08 AM RE: WP-32S in 2016? - walter b - 01-11-2016, 07:34 AM RE: WP-32S in 2016? - Paul Dale - 01-11-2016, 08:05 AM RE: WP-32S in 2016? - walter b - 01-11-2016, 08:30 AM RE: WP-32S in 2016? - Dieter - 01-11-2016, 01:40 PM RE: WP-32S in 2016? - walter b - 01-11-2016, 02:07 PM RE: WP-32S in 2016? - walter b - 01-12-2016, 04:13 PM RE: WP-32S in 2016? - emece67 - 01-12-2016, 07:47 PM RE: WP-32S in 2016? - Dieter - 01-12-2016, 08:29 PM RE: WP-32S in 2016? - walter b - 01-12-2016, 11:35 PM RE: WP-32S in 2016? - walter b - 01-13-2016, 10:02 AM RE: WP-32S in 2016? - emece67 - 01-13-2016, 11:41 AM RE: WP-32S in 2016? - walter b - 01-13-2016, 12:04 PM RE: WP-32S in 2016? - rprosperi - 01-13-2016, 03:57 PM RE: WP-32S in 2016? - walter b - 01-10-2016, 08:30 PM RE: WP-32S in 2016? - Dieter - 01-10-2016, 08:46 PM RE: WP-32S in 2016? - walter b - 01-10-2016, 08:53 PM RE: WP-32S in 2016? - walter b - 01-11-2016, 08:02 AM RE: WP-32S in 2016? - rprosperi - 01-08-2016, 01:08 AM RE: WP-32S in 2016? - walter b - 01-08-2016, 06:38 PM RE: WP-32S in 2016? - John Smitherman - 01-05-2016, 12:32 AM RE: WP-32S in 2016? - walter b - 01-06-2016, 12:05 PM RE: WP-32S in 2016? - Didier Lachieze - 01-06-2016, 12:31 PM RE: WP-32S in 2016? - Luigi Vampa - 01-07-2016, 03:22 PM RE: WP-32S in 2016? - walter b - 01-08-2016, 06:42 PM RE: WP-32S in 2016? - Paul Dale - 01-08-2016, 06:27 AM RE: WP-32S in 2016? - emece67 - 01-08-2016, 10:01 AM RE: WP-32S in 2016? - walter b - 01-08-2016, 07:01 PM RE: WP-32S in 2016? - Dieter - 01-08-2016, 09:36 PM RE: WP-32S in 2016? - walter b - 01-09-2016, 09:41 AM RE: WP-32S in 2016? - Dieter - 01-09-2016, 06:22 PM RE: WP-32S in 2016? - walter b - 01-09-2016, 09:51 PM RE: WP-32S in 2016? - emece67 - 01-09-2016, 09:58 AM RE: WP-32S in 2016? - Dieter - 01-08-2016, 09:09 PM RE: WP-32S in 2016? - Luigi Vampa - 01-08-2016, 09:47 PM RE: WP-32S in 2016? - emece67 - 01-09-2016, 10:03 AM RE: WP-32S in 2016? - Paul Dale - 01-09-2016, 10:42 PM RE: WP-32S in 2016? - matthiaspaul - 01-12-2016 12:08 AM RE: WP-32S in 2016? - Dieter - 01-12-2016, 12:27 AM RE: WP-32S in 2016? - matthiaspaul - 01-15-2016, 09:05 PM RE: WP-32S in 2016? - emece67 - 01-08-2016, 10:30 AM RE: WP-32S in 2016? - emece67 - 01-08-2016, 12:25 PM RE: WP-32S in 2016? - emece67 - 01-08-2016, 04:44 PM RE: WP-32S in 2016? - Luigi Vampa - 01-10-2016, 03:06 PM RE: WP-32S in 2016? - walter b - 01-10-2016, 03:17 PM RE: WP-32S in 2016? - Paul Dale - 01-12-2016, 03:07 AM

User(s) browsing this thread: 1 Guest(s)