Post Reply 
Question for Joe Horn, Dieter, and other
11-01-2017, 05:32 PM
Post: #1
Question for Joe Horn, Dieter, and other
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
Find all posts by this user
Quote this message in a reply
11-01-2017, 07:02 PM
Post: #2
RE: Question for Joe Horn, Dieter, and other
(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
Find all posts by this user
Quote this message in a reply
11-01-2017, 07:12 PM
Post: #3
RE: Question for Joe Horn, Dieter, and other
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.
Find all posts by this user
Quote this message in a reply
11-01-2017, 07:33 PM
Post: #4
RE: Question for Joe Horn, Dieter, and other
For multiplication this is nice:

[[ 5. ]
[ .0016 ]]

[[ 1. .000123 ]]

[[ 5. .000615 ]
[ .0016 .0000001968 ]]
Find all posts by this user
Quote this message in a reply
11-01-2017, 09:53 PM
Post: #5
RE: Question for Joe Horn, Dieter, and other
Interval arithmetic rather than complex is the answer here?


Pauli
Find all posts by this user
Quote this message in a reply
11-02-2017, 03:30 AM
Post: #6
RE: Question for Joe Horn, Dieter, and other
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.

X<> c
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
11-02-2017, 04:20 AM
Post: #7
RE: Question for Joe Horn, Dieter, and other
With a little (but still constant) more work, Khahan summation is useful. This guarantees control of rounding errors in sum.
Find all posts by this user
Quote this message in a reply
11-02-2017, 04:39 AM
Post: #8
RE: Question for Joe Horn, Dieter, and other
(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
Find all posts by this user
Quote this message in a reply
11-03-2017, 03:43 AM
Post: #9
RE: Question for Joe Horn, Dieter, and other
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.
Find all posts by this user
Quote this message in a reply
11-03-2017, 08:32 PM
Post: #10
RE: Question for Joe Horn, Dieter, and other
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
Find all posts by this user
Quote this message in a reply
11-05-2017, 01:48 PM
Post: #11
RE: Question for Joe Horn, Dieter, and other
(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
Find all posts by this user
Quote this message in a reply
11-05-2017, 01:57 PM
Post: #12
RE: Question for Joe Horn, Dieter, and other
(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.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-05-2017, 06:06 PM
Post: #13
RE: Question for Joe Horn, Dieter, and other
(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).
Find all posts by this user
Quote this message in a reply
11-05-2017, 07:46 PM
Post: #14
RE: Question for Joe Horn, Dieter, and other
(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
Find all posts by this user
Quote this message in a reply
Post Reply 




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