HUGE Arithmetic BUG !!!
-
- Enthusiast
- Posts: 423
- Joined: Fri Apr 25, 2003 5:22 pm
- Contact:
Another explanation:
The power is short writing for
x^n = x*x*x*x...,
similar to n*x for x+x+x+x...,
similar to UNION {k from 1 to n} M_k = M_1 union M_2 union M_3 ... union M_k
similar to SECTION {k from 1 to n} M_k = M_1 section M_2 ... section M_k,
What I mean is:
All of them are defined for NONE elements (e.g. the sum from 1 to 0 of elements, or a product of no elements, etc.) to the NEUTRAL element of the according operation.
So the sum from 1 to 0 gives 0 per definition, the UNION from 1 to 0 gives the empty set, the SECTION gives the whole set's universe instead. And so gives x^0 the same as 0^0 = 1 (the neutral element of multiplication), the same for faculty: 0! = 1
This is the explanation for this stuff I heard at university, but I like MrMats explanation, too!
btw PI=3
The power is short writing for
x^n = x*x*x*x...,
similar to n*x for x+x+x+x...,
similar to UNION {k from 1 to n} M_k = M_1 union M_2 union M_3 ... union M_k
similar to SECTION {k from 1 to n} M_k = M_1 section M_2 ... section M_k,
What I mean is:
All of them are defined for NONE elements (e.g. the sum from 1 to 0 of elements, or a product of no elements, etc.) to the NEUTRAL element of the according operation.
So the sum from 1 to 0 gives 0 per definition, the UNION from 1 to 0 gives the empty set, the SECTION gives the whole set's universe instead. And so gives x^0 the same as 0^0 = 1 (the neutral element of multiplication), the same for faculty: 0! = 1
This is the explanation for this stuff I heard at university, but I like MrMats explanation, too!
btw PI=3

%1>>1+1*1/1-1!1|1&1<<$1=1
PI = 3

okay so from your post i see that you agree that pb should act the way it does.
okay, i belive you stop calling me a donkey!!
and psycopanta: you have more important things to do: viewtopic.php?p=88505#88505

It's also defined for a zero value x with finite n, in which case 0^n = 0*0*0*0... = 0, which leads us back to the same problem!Froggerprogger wrote:x^n = x*x*x*x...,
What I mean is:
All of them are defined for NONE elements (e.g. the sum from 1 to 0 of elements, or a product of no elements, etc.) to the NEUTRAL element of the according operation.
So the sum from 1 to 0 gives 0 per definition, the UNION from 1 to 0 gives the empty set, the SECTION gives the whole set's universe instead. And so gives x^0 the same as 0^0 = 1 (the neutral element of multiplication), the same for faculty: 0! = 1
I agree it is giving the 'right' (the useful!) answer. If anyone was ever doing limits in PureBasic then they'd have to think carefully about what is going on, but if they were doing limits they'd probably be using a computer algebra package like Mathematica in the first place... So i think we can agree Fred got it right!thefool wrote:so you think purebasic is handling this the right way..
but again you are probaly right at the 0^0 is indefinate, but after understanding that i still think purebasic puts out the right answer.

Mat
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
thefool wrote:okay, i belive you stop calling me a donkey!!
and psycopanta: you have more important things to do: viewtopic.php?p=88505#88505

I say 0^0=1 is an error because it is a CONVENIENCE, so it is not a valid math equation, but a concrete interest for a concrete situation. If maths are convenience interests, then science would be idealism.jack wrote:if 0^0=1 is an error then exp(0)=1 should be an error also.

exp(0) ? Whats that?
The best explanation given here is not lim x^0 as x->0+ , neither lim 0^x as x->0+ , but lim x^x as x->0+ that's the more correct and humble answer


- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Its the fact that the answer (to most people who will see 0^0) is expected to be 1.
Most modern calculators will display 1.
Most textbooks will say, "unknown state, but take the result to be 1" or "can be replaced by 1".
If your so convinced that its incorrect, then check for it beforehand and make the appropriate changes to your code. It is a programming language after all, not a simple calculator - it should be an easy check you you to make. It will make you happy and contented.
I personally check for division by zero (another equation that can have 2 possible answers, neither of them being possible to be represented by PureBasics REAL number system, that itself is inherited from the x86). I'd rather not really on the processor interpreting the result and presenting the user with an error condition because the processor just crashed.
I'd also suggest writing a petition to all the major calculator and processor manufacturers, telling them they much introduce another error condition into their systems if your really that bothered as to continue this thread to 3-4 pages.
Most modern calculators will display 1.
Most textbooks will say, "unknown state, but take the result to be 1" or "can be replaced by 1".
If your so convinced that its incorrect, then check for it beforehand and make the appropriate changes to your code. It is a programming language after all, not a simple calculator - it should be an easy check you you to make. It will make you happy and contented.

I personally check for division by zero (another equation that can have 2 possible answers, neither of them being possible to be represented by PureBasics REAL number system, that itself is inherited from the x86). I'd rather not really on the processor interpreting the result and presenting the user with an error condition because the processor just crashed.
I'd also suggest writing a petition to all the major calculator and processor manufacturers, telling them they much introduce another error condition into their systems if your really that bothered as to continue this thread to 3-4 pages.

https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
A good way to understand why x^0 should always be one is to plot a graph of the following:
Trying changing i. For whatever value you have the following is true:
i to the power of a positive number will give you a value greater than 1.
i to the power of a negative number will give you a value between 0 and 1.
If you make i to the power of 0, 0, then your graph will not be continuous. It will approach 1, leap to 0, and the leap back up to close to 1.
Like in the following:
Making Pow(i, 0) always 1 will give a continuous graph.
Code: Select all
i = 2
For e = -5 To 5
Debug Pow(i,e)
Next e
i to the power of a positive number will give you a value greater than 1.
i to the power of a negative number will give you a value between 0 and 1.
If you make i to the power of 0, 0, then your graph will not be continuous. It will approach 1, leap to 0, and the leap back up to close to 1.
Like in the following:
Code: Select all
Debug Pow(10, 0.0001)
Debug 0
Debug Pow(10, -0.0001)
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
All of you are making me to repeat it, because it looks like you didn't see.
i^0 or 0^i are expressions where there is in advance supossed i<>0, and is just here where the confusion (or convention) lies.The best explanation given here is not lim x^0 as x->0+ , neither lim 0^x as x->0+ , but lim x^x as x->0+ that's the more correct and humble answer
i can insult you WITHOUT logical arguements if you wantPsychophanta wrote:thefool wrote:okay, i belive you stop calling me a donkey!!
and psycopanta: you have more important things to do: viewtopic.php?p=88505#88505
Weeelll, okay, i am in a doubt with you, you can insult me once, but please with logical arguments, ehhh!?

okay i belive that x^0 is only 1 if x>0 .
but i also belive the answer should be 1 in this case..

okay enough discussion,..!
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact: