Page 2 of 3
Posted: Thu Sep 18, 2008 11:43 pm
by Road Runner
That is also wrong, coz the correct calculation should be:
No, the correct calculatuion is as I stated.
The number of iterations doesn't come into the calculaton of the errror.
The exact result is 10,000,001 and all errors should be referenced to that exact result.
Posted: Fri Sep 19, 2008 8:47 am
by Psychophanta
lol.
are you joking or what?
Posted: Fri Sep 19, 2008 9:57 am
by Froggerprogger
@Psychophanta:
Imagine the algorithm as a black box. It should anyhow produce the number 10000001.0. But it produces e.g. 10000001.0010595 no matter how. So the total error is calculated as Road Runner said and is independant of the number of iterations used for computing the result somewhere inside the black box. Its a bit misleading that the result is nearly the same as the loopcount, because of the +1.0 inside.
I like these splitting hairs discussions.
Posted: Fri Sep 19, 2008 11:12 am
by Psychophanta
@Froggerprogger & @Road Runner:
The error is taken by a unique equal operation; i.e. if 2 or more equal operations (2 times the same algorithm) are performed, then you must calculate the loss (error) per pass, i.e. per times the algorithm is performed.
Imagine the algorithm as a black box. It should anyhow produce the number 0.0. But it produces e.g. 0.0010595 no matter how.
How now do you calculate?
Please don“t make me to loose my little time.
I hope this is enough for you and Road Runner user to see it and not disturb anymore with lies, silly mistakes, etc.
Posted: Fri Sep 19, 2008 11:37 am
by Froggerprogger
1. We have to specify the error
of what to calculate: e.g. the error of one single math-function, or the error of a whole algorithm as a black-box (in which perhaps the errors of many primitive functions might cumulate).
2. If there's an input to the algorithm/function, then we have to decide if we talk about the maximal possible error, or the mean error, or about some concrete example(s).
3. We have to decide which kind of error to calculate: the absolute or the relative error
Road Runner decided at 1. to calculate the error of the whole (black-box-)algorithm that should produce 10000001 if we would assume a mathematically perfect calculating machine, but it does produce 10000001.0010595...
As long as there's no input, we don't have to care about 2.
At 3. he decided to calculate the relative error (in percent). If Xs is the expected result and Xr is the produced result, then the absolute error is defined as:
|Xr - Xs|
and the relative error as:
|Xr - Xs| / |Xs|
(here both as absolute values). So all is in common with the theory of numerical errors.
Imagine the algorithm as a black box. It should anyhow produce the number 0.0. But it produces e.g. 0.0010595 no matter how.
How now do you calculate?
absolute error: 0.0010595
relative error: not defined (the case Xs = 0.0 is explicitely taken out)
This is how it was teached in my Numeric-lecture at University - so I'm right

Posted: Fri Sep 19, 2008 12:45 pm
by Psychophanta
You are talking about other different cases.
Lets take this present case, in which a value is loosed due to an algorithm, which is repeated identically a number of n times. The error is dragged throw the iterations and so then the error grows and grows, the more number of iterations the more dragged error. Isolated variables; no external inputs, etc.
Froggerprogger wrote:Imagine the algorithm as a black box. It should anyhow produce the number 0.0. But it produces e.g. 0.0010595 no matter how.
How now do you calculate?
absolute error: 0.0010595
relative error: not defined (the case Xs = 0.0 is explicitely taken out)
well, since you go away from the issue, i give you this:
Code: Select all
value.d=10000000.
For n=1 To 10000000
value=Tan(ATan(Pow(10.,Log10(Sqr(value*value)))))-1.
Next
Debug value
and now
give me the error treated here in this forum thread, which is "relative" (following your own words or the ones from some universities).
Is it not defined? And you still argue?
Then the only thing i can guess is you are "pulling my leg".
I have the way to calculate the relative error of that, i.e. formula i wrote above which is:
Abs(Result-ExpectedResult)/n*100
but for you is not defined

. Very bad, is not it?
Posted: Fri Sep 19, 2008 2:25 pm
by Road Runner
Psychophanta,
The original post in this thread stated "error in % = 0.000010005" so we are dealing here with percentage errors.
In your example the exact answer is zero so if your "value" is anything other than zero then the % error is infinite (not undefined).
It may not be a useful result but it
is the percentage error.
In this case it would be better to express the error as an absolute value, not a percentage, but how sospel wishes to express the error is up to him.
an algorithm, which is repeated identically a number of n times. The error is dragged throw the iterations and so then the error grow and grow, the more number of iterations the more gragged error.
It really doesn't matter how the final result is calculated. sospel was looking for an error in the final value, not the error in each stage of the calculation.
The error in each stage of the calculation cannot be determined from sospel's program because positive and negative errors within the loop will tend to cancel.
Posted: Fri Sep 19, 2008 3:06 pm
by Froggerprogger
@Psychophanta
What you try to calculate is the mean absolute error of the expression:
Code: Select all
Tan(ATan(Pow(10.,Log10(Sqr(value*value)))))
when using the values 1 up to 10000000 for the variable 'value'.
You can do this by dividing the sum of all individual errors by the number of examples (here 10000000). But you have to keep in mind, that you must not cumulate the errors as in the example then, because the formula sometimes returns bigger, and sometimes smaller results than desired, so cumulating these values as in the given algorithm these effects do sometimes arise and sometimes shrink the total error. The correct alternative would be to first cumulate all the individual errors by their
absolute value and then to divide this by the number of tests.
[edit]Whoops, I'm just too slow with answering... have too much time today...[/edit]
Posted: Fri Sep 19, 2008 4:36 pm
by blueznl
To be honest, it is irrelevant. We could discuss the philosphy behind the error check, but it would not invalidate the test by itself. If he / she / it

decides to see a certain test as a valid approach to establishing the accuracy of a language, then that's fine
Being statistical or mathematical incorrect does not invalidate the fact that with a higher programming language accuracy the results would be more accurate.
Posted: Fri Sep 19, 2008 7:20 pm
by Froggerprogger
I agree that it is
not relevant, but I disagree with naming it
irrelevant. But this brings us just another hair to be splitted by discussion...
Anyway, those very pedantic discussions do sometimes bring a new idea or some clarifications or deeper understanding - as long as they do not become nasty, but keep love&peace instead.
And the difference between irrelevant and not relevant has the same relevance as the difference between a white car and a not black car.
Posted: Fri Sep 19, 2008 9:20 pm
by Psychophanta
Well, i also agree that it is not very relevant.
But anyway i'd like to demonstrate to blueznl and to all that these 2 users are wrong.
The demonstration is easy: just look at my last example and look at the answer of these 2 dudes about it:
In your example the exact answer is zero so if your "value" is anything other than zero then the % error is infinite (not undefined).
Enough, thanks!
P.D... and sorry about my rudeness.
Posted: Fri Sep 19, 2008 9:34 pm
by blueznl
Welllllll......... whatever
Let's hope Fred fixes it fast

Posted: Fri Sep 19, 2008 9:40 pm
by Thalius
i bet for "fred" it works already.
and i am sooo not referring to /warning window off and "/Users/home/fred here ! *whistles!*
Thalius
Posted: Fri Sep 19, 2008 9:56 pm
by Road Runner
Psychophanta,
i'd like to demonstrate to blueznl and to all that these 2 users are wrong
Just because you don't understand what these 2 users are trying to explain doesn't mean they are wrong.
Posted: Fri Sep 19, 2008 10:36 pm
by Froggerprogger
@Psychophanta
Ok, here as requested my
three cents about your formula:
Code: Select all
errorValue = Abs(Result-ExpectedResult)/n*100.0
1. The formula does only calculate an absolute error, though usually any kind of relative error is more interesting. E.g. if you expect 1000.0 but achieve 1000.1 in n=10 loops you get an error-value of: 100.0 * 0.1 / 10 = 1.0. Nice. But if you expect 0.000001 but achieve 0.100001 you get the same error-value of 100.0 * 0.1 / 10 = 1.0. But intuitively (as given by any relative error) the error-value should be MUCH larger in the second example, because the result is
totally different than expected.
2. The formula is intended to calculate a percentage-value, but you cannot specify
of what it is a percentage. E.g. if expected result is 0.0 but you produce the value 0.1 in 10 loops, your error-value is: 100.0 * 0.1 / 10 = 1.0 again. So it should be 1% - but 1% of what ?
3. The formula tries to calculate the error of an individual instruction that is often repeated, but
without taking alternating errors into accound, e.g. your formula would show, that the following procedure getZero() (which is intended to... well to return 0) has no error:
Code: Select all
Procedure.l getZero(val.l) ; should return 0, but ... err... produces some error :)
If val&1
ProcedureReturn 1
Else
ProcedureReturn -1
EndIf
EndProcedure
value.l = 0
For i=1 To 1000
value + getZero(value)
Next
Debug value ; 0
Debug Abs(value - 0.0)/1000.0 * 100.0 ; error-value
Because in the end value is 0 - just as intended because we wanted to add 1000 times 0 - and so the error is 0, we know now, that getZero() works as intended ? What is the benefit of an error-value of 0.0 here ?
So many questions...
...and the answer my friend...
...is where all these nice flowers have gone...