Post Reply 
Error margins
10-28-2024, 03:33 PM
Post: #7
RE: Error margins
(10-27-2024 02:51 PM)Thomas Klemm Wrote:  You might consider dual numbers:
Automatic differentiation using dual numbers
Here's an example on how this could be used for a circuit of two parallel resistors.

FYI, this only work with + * (parallel resistance intervals work due to luck)
For - /, we need to flip the sign of 2nd number, to maximize intervals
Other changes may need to adapt to other functions.

lua> R1 = D.new(3,4e-5) ≡ 3 ± 4*ε
lua> R2 = D.new(5,6e-5) ≡ 5 ± 6*ε
lua> pprint(R1-R2) -- BAD
{ -2, -1.9999999999999998e-05 }
lua> pprint(R1/R2) -- BAD
{ 0.6, 8e-07 }

lua> R2[2] = -R2[2] -- flip sign
lua> pprint(R1-R2) -- OK
{ -2, 1e-04 }
lua> pprint(R1/R2) -- OK
{ 0.6, 1.52e-05 }

Note, last is not true interval, but if ε is small, it is good enough.
Interval math, center is affected by ε term. Dual does not do that.

R1/R2 = (3-4ε)/(5+6ε) .. (3+4ε)/(5-6ε) ≈ 0.6000000001824 ± 1.520000000219e-5



For more complicated expression, however, end-points may not work.
For f(x±eps), we really need to consider the whole shape.

a = min(f(x±eps))
b = max(f(x±eps))
f(x±eps) = (b+a)/2 ± (b-a)/2

Worse, calculations cannot not be "chained".
If we apply g on top, f(x±eps) calculations should be tossed.

a = min(g(f(x±eps)))
b = max(g(f(x±eps)))
g(f(x±eps)) = (b+a)/2 ± (b-a)/2

Of course, we can ignore all this, and just use interval end-points.
But, resulting intervals may not be right. Garbage in, Garbage out.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Error margins - Maximilian Hohmann - 10-27-2024, 01:45 PM
RE: Error margins - Thomas Klemm - 10-27-2024, 02:51 PM
RE: Error margins - Albert Chan - 10-28-2024 03:33 PM
RE: Error margins - born2laser - 10-28-2024, 04:59 PM
RE: Error margins - Albert Chan - 10-28-2024, 05:34 PM
RE: Error margins - carey - 10-28-2024, 05:47 PM
RE: Error margins - born2laser - 10-28-2024, 08:35 PM
RE: Error margins - carey - 10-28-2024, 09:37 PM
RE: Error margins - Albert Chan - 10-29-2024, 03:07 PM
RE: Error margins - LinusSch - 10-27-2024, 06:12 PM
RE: Error margins - dm319 - 10-28-2024, 08:23 AM
RE: Error margins - LinusSch - 10-28-2024, 03:02 PM
RE: Error margins - dm319 - 10-28-2024, 03:31 PM
RE: Error margins - raprism - 10-28-2024, 07:24 PM
RE: Error margins - Albert Chan - 10-28-2024, 08:08 PM
RE: Error margins - Thomas Klemm - 10-28-2024, 07:49 PM
RE: Error margins - Mark Power - 10-28-2024, 08:39 PM
RE: Error margins - Thomas Klemm - 10-28-2024, 10:24 PM
RE: Error margins - Thomas Klemm - 11-01-2024, 11:27 AM
RE: Error margins - Thomas Klemm - 11-01-2024, 11:28 AM
RE: Error margins - c3d - 11-09-2024, 09:05 PM
RE: Error margins - raprism - 11-11-2024, 11:41 AM
RE: Error margins - Albert Chan - 11-11-2024, 12:10 PM
RE: Error margins - raprism - 11-11-2024, 12:46 PM
RE: Error margins - Csaba Tizedes - 11-11-2024, 10:18 AM



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