1. Calculating with imprecise values
- Posted by Juergen Luethje <j.lue at gmx.de> Dec 13, 2005
- 679 views
Do we already have an Eu library for calculating with imprecise values? I couldn't find such a library in the archives. I mean something along the following lines: Say we have measured two distances, 3.4 cm and 4.7 cm, and we want to add them. Since those values are normally not 100% precise, the result is not necessarily (3.4+4.7) cm = 8.1 cm. If the values have been rounded, and "3.4" means something between 3.35 and 3.44, and "4.7" means something between 4.65 and 4.74, then the result can be any value between 8.00 cm and 8.18 cm. If we don't already have such a library, is there any interest? Regards, Juergen
2. Re: Calculating with imprecise values
- Posted by Alex Chamberlain <alex.chamberlain at tiscali.co.uk> Dec 13, 2005
- 657 views
I wrapped UCalc.dll once - that does very precise stuff, but I can't think of ne that does it in pure Euphoria - what about Matheval? Alex
3. Re: Calculating with imprecise values
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Dec 13, 2005
- 635 views
Juergen Luethje wrote: > > Do we already have an Eu library for calculating with imprecise values? > I couldn't find such a library in the archives. I mean something along > the following lines: > Say we have measured two distances, 3.4 cm and 4.7 cm, and we want to > add them. Since those values are normally not 100% precise, the result > is not necessarily (3.4+4.7) cm = 8.1 cm. If the values have been > rounded, and "3.4" means something between 3.35 and 3.44, and "4.7" > means something between 4.65 and 4.74, then the result can be any value > between 8.00 cm and 8.18 cm. > > If we don't already have such a library, is there any interest? > It sounds like fuzzy numbers and fuzzy arithmetic. I've thought about writing something to do this, but haven't yet... Matt Lewis
4. Re: Calculating with imprecise values
- Posted by jxliv7 <jxliv7 at hotmail.com> Dec 13, 2005
- 692 views
- Last edited Dec 14, 2005
Juergen, what i think you're talking about is significant digits and significant decimals. there's some excellent discussions of them at http://mathforum.org/dr.math/ and in particular http://mathforum.org/library/drmath/view/56375.html http://mathforum.org/library/drmath/view/59014.html there are no Euphoria libraries that i know of that deal with this, since the results of any multiplication, division, addition, substraction, sqare root, etc., can vary considerably dependent on what the user wants. figuring taxes is different (between Europe and the US, for example), rounding is different (which digit to base the rounding on, round up, round down, truncate), scientific calculations are different, etc. what i've done with my apps is basically have the user make the choice beforehand of the precision of any calculation. hope that helps, -- jon
5. Re: Calculating with imprecise values
- Posted by Juergen Luethje <j.lue at gmx.de> Dec 13, 2005
- 603 views
- Last edited Dec 14, 2005
jxliv7 wrote: > Juergen, what i think you're talking about is significant digits and > significant > decimals. there's some excellent discussions of them at > http://mathforum.org/dr.math/ > and in particular > http://mathforum.org/library/drmath/view/56375.html > http://mathforum.org/library/drmath/view/59014.html I think what I mean is something mentioned on this ^^^^ page. > there are no Euphoria libraries that i know of that deal with this, since the > results of any multiplication, division, addition, substraction, sqare root, > etc., can vary considerably dependent on what the user wants. figuring taxes > is different (between Europe and the US, for example), Yes, of course. > rounding is different > (which digit to base the rounding on, round up, round down, truncate), > scientific > calculations are different, etc. > > what i've done with my apps is basically have the user make the choice > beforehand > of the precision of any calculation. > > hope that helps, Thanks. I think what I mean has got to do with what is called "error propagation". For example, if I measure a length with a ruler that shows millimeters, the measurement will be accurate to one millimeter. So if I measure the value 12 mm, the "real" value is somewhere between 11.5 and 12.5 mm. Then I measure another distance, and I get 4 mm, that means the "real" value is somewhere between 3.5 and 4.5 mm. Now for some reason I have ro add both values. So I am thinking of a function like the following:
function add_with_error (atom a, atom delta_a, atom b, atom delta_b) atom min, max min = (a-delta_a) + (b-delta_b) max = (a+delta_a) + (b+delta_b) return {min, max} end function
Given the example above, I would call the function like this:
? add_with_error(12,0.5,4,0.5)
This prints {15,17}. So I have got some *additional* information. Normally I would get the result 12+4 => 16, and I would have the feeling "Well, 16 might not be the exact result, because the ruler is not 100% precise". Using a function such as add_with_error(), I know now that the actual result is between 15 and 17. Does that make sense?Regards, Juergen -- Have you read a good program lately?
6. Re: Calculating with imprecise values
- Posted by Juergen Luethje <j.lue at gmx.de> Dec 13, 2005
- 640 views
- Last edited Dec 14, 2005
Matt Lewis wrote: <snip> > It sounds like fuzzy numbers and fuzzy arithmetic. I've thought about > writing something to do this, but haven't yet... I'm not sure whether I understand the meaning of the expressions "fuzzy numbers" and "fuzzy arithmetic" correctly.I do not mean what is called "Fuzzy Logic" (according to Lotfi Zadeh and others) -- although I considers that very useful.
What I mean ATM is something that I think has got to do with "error propagation". Please see my reply to "jxliv7" for details. Thanks, Juergen -- Have you read a good program lately?
7. Re: Calculating with imprecise values
- Posted by cklester <cklester at yahoo.com> Dec 13, 2005
- 632 views
- Last edited Dec 14, 2005
Juergen Luethje wrote: > Matt Lewis wrote: > > It sounds like fuzzy numbers and fuzzy arithmetic. I've thought about > > writing something to do this, but haven't yet... > I'm not sure whether I understand the meaning of the expressions "fuzzy > numbers" and "fuzzy arithmetic" correctly. It just means they tickle when you use them. -=ck "Programming in a state of Euphoria." http://www.cklester.com/euphoria/
8. Re: Calculating with imprecise values
- Posted by Juergen Luethje <j.lue at gmx.de> Dec 13, 2005
- 641 views
- Last edited Dec 14, 2005
cklester wrote: > Juergen Luethje wrote: >> Matt Lewis wrote: >>> It sounds like fuzzy numbers and fuzzy arithmetic. I've thought about >>> writing something to do this, but haven't yet... >> I'm not sure whether I understand the meaning of the expressions "fuzzy >> numbers" and "fuzzy arithmetic" correctly. > > It just means they tickle when you use them. Oh, I see. I had believed it was my girlfriend who stood behind me and tickled me.) Regards, Juergen
9. Re: Calculating with imprecise values
- Posted by Elliott Sales de Andrade <quantum_analyst at hotmail.com> Dec 14, 2005
- 619 views
Juergen Luethje wrote: > <snip> > What I mean ATM is something that I think has got to do with "error > propagation". Please see my reply to "jxliv7" for details. > Well, there are no Euphoria programs that I know of, but in University we use this form of error propagation: http://www.upscale.utoronto.ca/PVB/Harrison/ErrorAnalysis/index.html > Thanks, > Juergen > > -- > Have you read a good program lately? ~[ WingZone ]~ http://wingzone.tripod.com/
10. Re: Calculating with imprecise values
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Dec 14, 2005
- 677 views
Juergen Luethje wrote: > > Matt Lewis wrote: > > <snip> > > > It sounds like fuzzy numbers and fuzzy arithmetic. I've thought about > > writing something to do this, but haven't yet... > > I'm not sure whether I understand the meaning of the expressions "fuzzy > numbers" and "fuzzy arithmetic" correctly.> I do not mean what is called "Fuzzy Logic" (according to Lotfi Zadeh and > others) -- although I considers that very useful.
> > What I mean ATM is something that I think has got to do with "error > propagation". Please see my reply to "jxliv7" for details. I think that Fuzzy numbers and arithmetic could be used for this, although it could be overkill. Here are a couple of so-so links to get you started: http://whatis.techtarget.com/definition/0,,sid9_gci283979,00.html Mathematica documentation on fuzzy arithmetic, which gives some visuals that might help: http://documents.wolfram.com/applications/fuzzylogic/Manual/9.html If you have good tolerance for reading math, this looks like a good paper that covers the basics, and has other interesting stuff: http://www.nist.gov/msidlibrary/doc/pfn-fss.pdf Matt Lewis
11. Re: Calculating with imprecise values
- Posted by Al Getz <Xaxo at aol.com> Dec 14, 2005
- 657 views
Hello there, I've used so called 'sensitivity' analysis in the past to measure changes in functions with respect to a given variable and this helped understand things better sometimes especially when human error is involved. For example.... for the equation with some function F: y=F(a,b,c) the sensitivity with change of parameter 'a' might be 100 times as great as with parameter 'b', and perhaps the sensitivity with respect to 'c' might be 1000 times lower than with 'a', meaning y hardly changes with 'b' or 'c' but changes quite a bit with parameter 'a'. Thus, the error in measurement in 'b' or 'c' doesnt matter as much as with the error in 'a'. This would mean great care should be used in measuring 'a' while with 'b' or 'c' you might get away with estimating from other parameters or whatever. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
12. Re: Calculating with imprecise values
- Posted by Juergen Luethje <j.lue at gmx.de> Dec 14, 2005
- 661 views
Elliott Sales de Andrade wrote: > Juergen Luethje wrote: > > <snip> >> What I mean ATM is something that I think has got to do with "error >> propagation". Please see my reply to "jxliv7" for details. >> > > Well, there are no Euphoria programs that I know of, but in > University we use this form of error propagation: > http://www.upscale.utoronto.ca/PVB/Harrison/ErrorAnalysis/index.html That text is well written and good understandable. Thank you! Regards, Juergen
13. Re: Calculating with imprecise values
- Posted by Juergen Luethje <j.lue at gmx.de> Dec 14, 2005
- 619 views
Al Getz wrote: > I've used so called 'sensitivity' analysis in the past to measure changes > in functions with respect to a given variable and this helped understand > things better sometimes especially when human error is involved. > > For example.... > > for the equation with some function F: > y=F(a,b,c) > > the sensitivity with change of parameter 'a' might be 100 times as great > as with parameter 'b', and perhaps the sensitivity with respect to 'c' > might be 1000 times lower than with 'a', meaning y hardly changes > with 'b' or 'c' but changes quite a bit with parameter 'a'. Thus, > the error in measurement in 'b' or 'c' doesnt matter as much as with > the error in 'a'. This would mean great care should be used in measuring > 'a' while with 'b' or 'c' you might get away with estimating from other > parameters or whatever. Interesting! Do you have a link at hand that explains sensitivity analysis more in detail?Regards, Juergen
14. Re: Calculating with imprecise values
- Posted by Juergen Luethje <j.lue at gmx.de> Dec 14, 2005
- 619 views
- Last edited Dec 15, 2005
Matt Lewis wrote: > Juergen Luethje wrote: > > > > Matt Lewis wrote: > > > > <snip> > > > > > It sounds like fuzzy numbers and fuzzy arithmetic. I've thought about > > > writing something to do this, but haven't yet... > > > > I'm not sure whether I understand the meaning of the expressions "fuzzy > > numbers" and "fuzzy arithmetic" correctly.> > I do not mean what is called "Fuzzy Logic" (according to Lotfi Zadeh and > > others) -- although I considers that very useful.
> > > > What I mean ATM is something that I think has got to do with "error > > propagation". Please see my reply to "jxliv7" for details. > > I think that Fuzzy numbers and arithmetic could be used for this, > although it could be overkill. Here are a couple of so-so links to > get you started: > > <a > href="http://whatis.techtarget.com/definition/0,,sid9_gci283979,00.html">http://whatis.techtarget.com/definition/0,,sid9_gci283979,00.html</a> > > Mathematica documentation on fuzzy arithmetic, which gives some > visuals that might help: > <a > href="http://documents.wolfram.com/applications/fuzzylogic/Manual/9.html">http://documents.wolfram.com/applications/fuzzylogic/Manual/9.html</a> > > > If you have good tolerance for reading math, this looks like a good > paper that covers the basics, and has other interesting stuff: > > <a > href="http://www.nist.gov/msidlibrary/doc/pfn-fss.pdf">http://www.nist.gov/msidlibrary/doc/pfn-fss.pdf</a> Very interesting, thank you! If I were able to write an Eu library for Fuzzy Arithmetic, I probably could/would/should ask my boss tommorrow to double my salary.
Regards, Juergen
15. Re: Calculating with imprecise values
- Posted by Al Getz <Xaxo at aol.com> Dec 16, 2005
- 614 views
Juergen Luethje wrote: > > Al Getz wrote: > > > I've used so called 'sensitivity' analysis in the past to measure changes > > in functions with respect to a given variable and this helped understand > > things better sometimes especially when human error is involved. > > > > For example.... > > > > for the equation with some function F: > > y=F(a,b,c) > > > > the sensitivity with change of parameter 'a' might be 100 times as great > > as with parameter 'b', and perhaps the sensitivity with respect to 'c' > > might be 1000 times lower than with 'a', meaning y hardly changes > > with 'b' or 'c' but changes quite a bit with parameter 'a'. Thus, > > the error in measurement in 'b' or 'c' doesnt matter as much as with > > the error in 'a'. This would mean great care should be used in measuring > > 'a' while with 'b' or 'c' you might get away with estimating from other > > parameters or whatever. > > Interesting! > Do you have a link at hand that explains sensitivity analysis more in > detail?> > Regards, > Juergen Hi Juergen, Sorry i dont have a link in mind, but a quick google turned up several sites including a 'forum' for Sens A. I didnt want it to sound too complicated though, because basically it's not, so here's a quick example to help show how simple it can really be.... First a pure approach then a numerical approach that can be used in an Eu program... I think a good example would be finding the volume of a rather long box with rectangular cross section we'll say the length of is 'a', and the two sides are 'b' and 'c'. This would look like a rectangular pipe. We want to find the volume, but also the change in volume so we can understand what happens when either of the measurements for a,b, and c are either off to begin with (due to measurement inaccuracies) or just to see what happens when a given dimension changes. For this example we'll say a=100 b=10 c=10 in inches. The volume would be v=a*b*c which we'll rewrite y=a*b*c First we take first partials: dy/da=b*c dy/db=a*c dy/dc=a*b and now we can call the sensitivities: Sya=dy/da=b*c Syb=dy/db=a*c Syc=dy/dc=a*b Where 'Sya' is read: "The sensitivity of y with respect to a". Now we look at the actual numerical value of these to see what we can find out: Sya=b*c=100 Syb=a*c=1000 Syc=a*b=1000 From this we can quickly see that Sya is ten times less than Syb or Syc, so the measurement in 'a' isnt as important as the measurement for 'b' or 'c'. Going back to the original equation with the chosen values for this example, we can see that a change of say 1/16 inch causes a much bigger change in volume when the change occurs in either b or c, while not as big of a change in volume when the change occurs in a. Writing this out as a 'formula' we get an approximate numerical method: Sya=(f(a+inc,b,c)-f(a,b,c))/inc Syb=(f(a,b+inc,c)-f(a,b,c))/inc Syc=(f(a,b,c+inc)-f(a,b,c))/inc where f(a,b,c)=a*b*c (the original volume equation), and 'inc' is a small number like 0.001. The above can be used in a program quite easily, but usually a slightly more accurate method is used in programs (the 'Central Means' formula): Sya=(f(a+inc,b,c)-f(a-inc,b,c))/(inc+inc) Syb=(f(a,b+inc,c)-f(a,b-inc,c))/(inc+inc) Syc=(f(a,b,c+inc)-f(a,b,c-inc))/(inc+inc) All that's involved here is calling the function f twice for each sensitivity: once using a positive inc and once a negative inc, then subtracting the results and dividing by twice the inc. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
16. Re: Calculating with imprecise values
- Posted by Juergen Luethje <j.lue at gmx.de> Dec 17, 2005
- 621 views
Al Getz wrote: [Sensitivity Analysis] > Hi Juergen, > > Sorry i dont have a link in mind, but a quick google turned up several > sites including a 'forum' for Sens A. I didnt want it to sound too > complicated though, because basically it's not, Much appreciated.> so here's a quick example to help show how simple it can really be.... > > First a pure approach then a numerical approach that can be used in > an Eu program... > > I think a good example would be finding the volume of a rather long > box with rectangular cross section we'll say the length of is 'a', > and the two sides are 'b' and 'c'. This would look like a rectangular > pipe. We want to find the volume, but also the change in volume so > we can understand what happens when either of the measurements for > a,b, and c are either off to begin with (due to measurement inaccuracies) > or just to see what happens when a given dimension changes. > > For this example we'll say > a=100 > b=10 > c=10 > in inches. > > The volume would be v=a*b*c which we'll rewrite > y=a*b*c > > First we take first partials: > dy/da=b*c > dy/db=a*c > dy/dc=a*b > > and now we can call the sensitivities: > Sya=dy/da=b*c > Syb=dy/db=a*c > Syc=dy/dc=a*b > > Where 'Sya' is read: "The sensitivity of y with respect to a". > > Now we look at the actual numerical value of these to see what > we can find out: > Sya=b*c=100 > Syb=a*c=1000 > Syc=a*b=1000 > > From this we can quickly see that Sya is ten times less than Syb or > Syc, so the measurement in 'a' isnt as important as the measurement > for 'b' or 'c'. > > Going back to the original equation with the chosen values for this > example, we can see that a change of say 1/16 inch causes a much > bigger change in volume when the change occurs in either b or c, while > not as big of a change in volume when the change occurs in a. I see. I can imagine that this kind of approach to a problem often can be very useful. > Writing this out as a 'formula' we get an approximate numerical > method: > Sya=(f(a+inc,b,c)-f(a,b,c))/inc > Syb=(f(a,b+inc,c)-f(a,b,c))/inc > Syc=(f(a,b,c+inc)-f(a,b,c))/inc > where > f(a,b,c)=a*b*c (the original volume equation), and > 'inc' is a small number like 0.001. > > The above can be used in a program quite easily, but usually a slightly > more accurate method is used in programs (the 'Central Means' formula): > Sya=(f(a+inc,b,c)-f(a-inc,b,c))/(inc+inc) > Syb=(f(a,b+inc,c)-f(a,b-inc,c))/(inc+inc) > Syc=(f(a,b,c+inc)-f(a,b,c-inc))/(inc+inc) > All that's involved here is calling the function f twice for each > sensitivity: once using a positive inc and once a negative inc, > then subtracting the results and dividing by twice the inc. Al, thanks a lot for the trouble writing down this comprehensive and good understandable explanation! Regards, Juergen -- What do you want to re-install today?
17. Re: Calculating with imprecise values
- Posted by Al Getz <Xaxo at aol.com> Dec 18, 2005
- 606 views
Juergen Luethje wrote: > > Al Getz wrote: > > [Sensitivity Analysis] > > > Hi Juergen, > > > > Sorry i dont have a link in mind, but a quick google turned up several > > sites including a 'forum' for Sens A. I didnt want it to sound too > > complicated though, because basically it's not, > > Much appreciated.> > > so here's a quick example to help show how simple it can really be.... > > > > First a pure approach then a numerical approach that can be used in > > an Eu program... > > > > I think a good example would be finding the volume of a rather long > > box with rectangular cross section we'll say the length of is 'a', > > and the two sides are 'b' and 'c'. This would look like a rectangular > > pipe. We want to find the volume, but also the change in volume so > > we can understand what happens when either of the measurements for > > a,b, and c are either off to begin with (due to measurement inaccuracies) > > or just to see what happens when a given dimension changes. > > > > For this example we'll say > > a=100 > > b=10 > > c=10 > > in inches. > > > > The volume would be v=a*b*c which we'll rewrite > > y=a*b*c > > > > First we take first partials: > > dy/da=b*c > > dy/db=a*c > > dy/dc=a*b > > > > and now we can call the sensitivities: > > Sya=dy/da=b*c > > Syb=dy/db=a*c > > Syc=dy/dc=a*b > > > > Where 'Sya' is read: "The sensitivity of y with respect to a". > > > > Now we look at the actual numerical value of these to see what > > we can find out: > > Sya=b*c=100 > > Syb=a*c=1000 > > Syc=a*b=1000 > > > > From this we can quickly see that Sya is ten times less than Syb or > > Syc, so the measurement in 'a' isnt as important as the measurement > > for 'b' or 'c'. > > > > Going back to the original equation with the chosen values for this > > example, we can see that a change of say 1/16 inch causes a much > > bigger change in volume when the change occurs in either b or c, while > > not as big of a change in volume when the change occurs in a. > > I see. I can imagine that this kind of approach to a problem often can > be very useful. > > > Writing this out as a 'formula' we get an approximate numerical > > method: > > Sya=(f(a+inc,b,c)-f(a,b,c))/inc > > Syb=(f(a,b+inc,c)-f(a,b,c))/inc > > Syc=(f(a,b,c+inc)-f(a,b,c))/inc > > where > > f(a,b,c)=a*b*c (the original volume equation), and > > 'inc' is a small number like 0.001. > > > > The above can be used in a program quite easily, but usually a slightly > > more accurate method is used in programs (the 'Central Means' formula): > > Sya=(f(a+inc,b,c)-f(a-inc,b,c))/(inc+inc) > > Syb=(f(a,b+inc,c)-f(a,b-inc,c))/(inc+inc) > > Syc=(f(a,b,c+inc)-f(a,b,c-inc))/(inc+inc) > > All that's involved here is calling the function f twice for each > > sensitivity: once using a positive inc and once a negative inc, > > then subtracting the results and dividing by twice the inc. > > Al, thanks a lot for the trouble writing down this comprehensive and > good understandable explanation! > > Regards, > Juergen > > -- > What do you want to re-install today? Hello again Juergen, Oh you're welcome, and i hope you find some good uses for this. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"