HP Forums
Question for Joe Horn, Dieter, and other - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Question for Joe Horn, Dieter, and other (/thread-9414.html)



Question for Joe Horn, Dieter, and other - Namir - 11-01-2017 05:32 PM

Considering real numbers that are very close to integer. That is a real number R is close to an integer I:

R = I + e

Where e = +/- a small number like 1e-8 or even less.

If I represent R using complex number notation (I, e), would the use of complex math operations (adding, subtracting, etc.) between two near-integer-value floating-point numbers, yield more accurate results than straight forward operations between these same numbers? That is, for example:

R1 * R1 is less accurate than? (I1, e1) * (I2, e2)

Namir


RE: Question for Joe Horn, Dieter, and other - Dieter - 11-01-2017 07:02 PM

(11-01-2017 05:32 PM)Namir Wrote:  If I represent R using complex number notation (I, e), would the use of complex math operations (adding, subtracting, etc.) between two near-integer-value floating-point numbers, yield more accurate results than straight forward operations between these same numbers? That is, for example:

R1 * R1 is less accurate than? (I1, e1) * (I2, e2)

For addition and subtraction it seems obvious that adding/subtracting the integer parts and "e" separately improves accuracy. On the one hand because "e" may be represeted exactly where I+e may already show roundoff errors, on the other hand because the result (I1+I2, e1+e2) may yield a more exact value for e1+e2 as both I1+I2 and e1+e2 may be represented with, say, 10 or 12 significant digits each.

But how do you want to multiply two numbers with this method?
(I1+e1)*(I2+e2) equals I1*I2+e1*I2+I1*e2+e1*e2 while (I1, e1)*(I2, e2) is (I1*I2–e1*e2,  I1*e2+I2*e1). Note the minus !

Dieter


RE: Question for Joe Horn, Dieter, and other - Gerald H - 11-01-2017 07:12 PM

I don't think complex numbers are the answer.

How about

7*X+.0000001

&

3*Y+.0000000045

With some manipulation that would be good for addition & multiplication.


RE: Question for Joe Horn, Dieter, and other - Gerald H - 11-01-2017 07:33 PM

For multiplication this is nice:

[[ 5. ]
[ .0016 ]]

[[ 1. .000123 ]]

[[ 5. .000615 ]
[ .0016 .0000001968 ]]


RE: Question for Joe Horn, Dieter, and other - Paul Dale - 11-01-2017 09:53 PM

Interval arithmetic rather than complex is the answer here?


Pauli


RE: Question for Joe Horn, Dieter, and other - Joe Horn - 11-02-2017 03:30 AM

Namir, do you have any concrete examples where using complex numbers as you propose would yield additional accuracy? If so, I'd love to see them.


RE: Question for Joe Horn, Dieter, and other - ttw - 11-02-2017 04:20 AM

With a little (but still constant) more work, Khahan summation is useful. This guarantees control of rounding errors in sum.


RE: Question for Joe Horn, Dieter, and other - Namir - 11-02-2017 04:39 AM

(11-02-2017 03:30 AM)Joe Horn Wrote:  Namir, do you have any concrete examples where using complex numbers as you propose would yield additional accuracy? If so, I'd love to see them.

Say we have:

R1 = 5.00000001 = (5, 0.00000001) =(I1, e1)
R1 = 4.00000001 = (4, 0.00000001) =(I2, e2)

Is R1 * R2 less accurate than (I1, e1) * (I2, e2)?

Is R1/R2 less accurate than (I1, e1) / (I2, e2)?

Namir


RE: Question for Joe Horn, Dieter, and other - ttw - 11-03-2017 03:43 AM

As you are not using the structure of the complex numbers, a list or an array of reals (or integers) may be easier to use.


RE: Question for Joe Horn, Dieter, and other - Csaba Tizedes - 11-03-2017 08:32 PM

Hi Namir!

When I was Mechanical Engineer student (17 years ago! OMG!!), I wrote short routines on my 32SII for calculating numbers with errors.

For example if I want to calculate what is the error of volume of a cylinder if the diameter is (0.2 +/- 0.01)m and the height is (0.5 +/- 0.015)m I must to know how to calculate (0.2 +/- 0.01)^2×PI÷4×(0.5 +/- 0.015).

Here is my routines: HP32SII Calculation with intervals.pdf, please check it.

The available routines:
  • LAST x
  • LAST y
  • ENTER
  • x CHANGE y
  • CLx ( == KILL)
  • STO
  • RCL
  • ADD
  • SUBSTRACT
  • MULTIPLICATE
  • DIVIDE
  • INVERSE
  • POWER
  • ROOT OF
  • NAT. LOG
  • --- and additionally ---
  • SINE
  • TAN

Enjoy!
Csaba


RE: Question for Joe Horn, Dieter, and other - Csaba Tizedes - 11-05-2017 01:48 PM

(11-03-2017 08:32 PM)Csaba Tizedes Wrote:  calculating numbers with errors

...what a silence here Big Grin I guess this is not so high.

It is based on this (Wikipedia).

17 years before my programming attitude was so strange and I found some unthinking part (eg. LBL K), so it is required to update. By the way with these routines easy to solve all error propagation calculation during engineering work. With new calculators which are capable to do differentiation, this task is more easily solvable.

Csaba


RE: Question for Joe Horn, Dieter, and other - rprosperi - 11-05-2017 01:57 PM

(11-05-2017 01:48 PM)Csaba Tizedes Wrote:  ...what a silence here Big Grin I guess this is not so high.

Probably the main reason for lack of feedback is the document is not in English, and most readers here are English speaking, with a lot of Spanish, French and German as well, however the document appeared to me to be in a different language than any of these.


RE: Question for Joe Horn, Dieter, and other - DGM - 11-05-2017 06:06 PM

(11-05-2017 01:57 PM)rprosperi Wrote:  
(11-05-2017 01:48 PM)Csaba Tizedes Wrote:  ...what a silence here Big Grin I guess this is not so high.

Probably the main reason for lack of feedback is the document is not in English, and most readers here are English speaking, with a lot of Spanish, French and German as well, however the document appeared to me to be in a different language than any of these.

Looks Hungarian to me (Google Translate of one of the words, and Csaba Tizedes' profile).


RE: Question for Joe Horn, Dieter, and other - Csaba Tizedes - 11-05-2017 07:46 PM

(11-05-2017 06:06 PM)DGM Wrote:  Looks Hungarian to me (Google Translate of one of the words, and Csaba Tizedes' profile).

Yes, this is Hungarian, but - unfortunately - I typed it without accents, therefore hard to translate it with Google (and Hungarian agglutinative language, therefore real challenge for the Google to translate from/to Hungarian).

By the way, this is not that what Namir is requested.

Csaba