 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Marc-Hendrik Bremer" <Mar### [at] t-online de> wrote in message
news:3a7feea6$1@news.povray.org...
>
> Scott Hill schrieb in Nachricht <3a7fe7cb@news.povray.org>...
> >Without brackets it is ambiguous, to a
> >degree - we may default to assuming that we're meant to follow the
standard
> >operator order rules but we don't and can't know that that assumption is
> >correct.
>
>
> Well, it is even ambiguous with brackets. Cause if you don't fallow the
> standard rules, you could give the brackets a totally different meaning.
> That's what makes all communication that faulty - we assume, that we
follow
> the same rules, but most of the time we don't. As a wise man said ones -
it
> is more of an wonder that communication does happens most of the time in a
> correct way than the opposite.
>
Hmm, yes, but not in the same way - you may as well say that it's
ambiguous because we _could_ interpret the numerical digits differently -
the problem is not that we're misinterpret anything, but, rather that there
isn't enough information in the original form - we need the precedence rules
to remove the ambiguity but they do not redefine or even clarify the meaning
of any of the symbols ('+' stills means 'plus', '-' still means 'minus' and
'*' still means 'times'). Likewise, adding brackets does not change the
meanings of any of the symbols, they just clarify how those symbols are
intended to interact.
Does that make any sense ?
Scott.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Scott Hill" <sco### [at] ncgraphics net> wrote in message
news:3a804217@news.povray.org...
<snip>
> Hmm, yes, but not in the same way - you may as well say that it's
> ambiguous because we _could_ interpret the numerical digits differently -
<snip>
Exactly - the sentence "the man went into the farmer's toilet and took his
trousers down" is ambiguous because we don't know whether the man takes his
own or the farmer's trousers down. It is also ambiguous because "trousers"
could mean "dictation". However, one is an ambiguity within the rules of
English, whereas the latter is only ambiguous if we ignore the rules of
English. We resolve the first by using common sense - we would generally
assume that the man takes his own trousers down (unless the book has been
purchased in a specialist shop and is being read one-handed).
Unfortunately, there is no common sense that can resolve "3+2*5". There is
nothing to imply that the multiplication occurs first. It would not be
illogical to write a parser that evaluated the addition first - it doesn't
break a rule, so much as a convention designed to resolve the inherant
ambiguity. However, to write a parser that ignored brackets or treated them
as some other operator would be an act of blatent idiocy.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Scott Hill schrieb in Nachricht <3a804217@news.povray.org>...
>Does that make any sense ?
>
Yes, it does. But only if you use a hierarchic structure for the rules, you
use. From a strictly mathematical point of you (I think) there is no
difference in the rule that multiplications are done before additions and
the one that tells you, what brackets mean or what the digit "2" mean. Or is
this not right?
From a more general point of view you and Tom are absolutely right of
course.
Marc-Hendrik
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Scott Hill wrote:
> No ! 5.
>
> That's the point - we and parsers all assume, because we've all learned
> (or, in the case of parsers, have been hard coded with) the correct operator
> ordering, that it evaluates to 3, but, I may not have meant that, I could
> just as easily meant ((1+2)*3)-4 ! Without brackets it is ambiguous, to a
> degree - we may default to assuming that we're meant to follow the standard
> operator order rules but we don't and can't know that that assumption is
> correct.
NO!! 1+2*3-4 is three, only three, exactly three, no more, no less, and most
certainly not and NEVER five. If you meant (1+2)*3-4, that would be analagous to
me typing orange and meaning purple. Anyone who types 1+2*3-4 and expects 5 is
an idiot.
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly wrote:
> Unfortunately, there is no common sense that can resolve "3+2*5". There is
> nothing to imply that the multiplication occurs first.
[snip]
Of course there is. It's called simple algebra.
a*x^2+b*x+c means what to you?
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
David Fontaine wrote in message <3A8085CA.B22C86A5@faricy.net>...
>NO!! 1+2*3-4 is three, only three, exactly three, no more, no less, and
most
>certainly not and NEVER five. If you meant (1+2)*3-4, that would be
analagous to
>me typing orange and meaning purple. Anyone who types 1+2*3-4 and expects 5
is
>an idiot.
I just typed the expression 1+2*3-4 into my TI-1795 calculator, and, as
expected, got the number 5.
--
Mark
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"David Fontaine" <dav### [at] faricy net> wrote in message
news:3A808672.D37E6BD5@faricy.net...
> Tom Melly wrote:
>
> > Unfortunately, there is no common sense that can resolve "3+2*5". There
is
> > nothing to imply that the multiplication occurs first.
>
> [snip]
> Of course there is. It's called simple algebra.
> a*x^2+b*x+c means what to you?
>
(a*(x^2)) + (b*x) + c - but this is not common sense, it is following a
convention that exists because common sense is not available.
In fact, one could argue that the only common sense option is to evaluate
the expression strictly left to right. IMHO common sense would dictate that
the solution is: (a*x)^2 + (b*x) + c.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"David Fontaine" <dav### [at] faricy net> wrote in message
news:3A8085CA.B22C86A5@faricy.net...
> NO!! 1+2*3-4 is three, only three, exactly three, no more, no less, and
most
> certainly not and NEVER five. If you meant (1+2)*3-4, that would be
analagous to
> me typing orange and meaning purple. Anyone who types 1+2*3-4 and expects
5 is
> an idiot.
>
I disagree. Anyone who types 2*1.5 and expects 5 is an idiot. Typing 1+2*3-4
and expecting 5 just means that they don't know the conventions. The
conventions exist because intelligence alone cannot resolve the issue.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Mark Wagner" <mar### [at] gte net> wrote in message
news:3a80db3a$1@news.povray.org...
>
> I just typed the expression 1+2*3-4 into my TI-1795 calculator, and, as
> expected, got the number 5.
>
Good point.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3a811457$1@news.povray.org>, "Tom Melly"
<tom### [at] tomandlu co uk> wrote:
> > Of course there is. It's called simple algebra.
> > a*x^2+b*x+c means what to you?
>
> (a*(x^2)) + (b*x) + c - but this is not common sense, it is following a
> convention that exists because common sense is not available.
>
> In fact, one could argue that the only common sense option is to evaluate
> the expression strictly left to right. IMHO common sense would dictate
> that the solution is: (a*x)^2 + (b*x) + c.
You still followed the precedece of * over +, I think it's even uglier:
((((a * x) ^ 2) + b) * x) + c
Unless you were only talking about individual terms.
I think my exponent patch (which allows you to use ^ for pow() in
ordinary scene code) breaks on this, instead of evaluating that as:
(a*(x^2)) + (b*x) + c
It will see:
((a*x)^2) + (b*x) + c
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Marc-Hendrik Bremer" <Mar### [at] t-online de> wrote in message
news:3a805846@news.povray.org...
>
> Scott Hill schrieb in Nachricht <3a804217@news.povray.org>...
>
> >Does that make any sense ?
> >
>
>
> Yes, it does. But only if you use a hierarchic structure for the rules,
you
> use. From a strictly mathematical point of you (I think) there is no
> difference in the rule that multiplications are done before additions and
> the one that tells you, what brackets mean or what the digit "2" mean. Or
is
> this not right?
>
Hmm. IMHO, no. But then I've just tried putting into words why they're
different and I can't. I'll have to ponder on this one for while....
> From a more general point of view you and Tom are absolutely right of
> course.
>
Of course. I'm _always_ right! ;-)
--
Scott Hill.
NC Graphics (Cambridge) Ltd.
http://www.ncgraphics.co.uk
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Chris Huff" <chr### [at] mac com> wrote in message
news:chrishuff-95BA06.05341707022001@news.povray.org...
> > that the solution is: (a*x)^2 + (b*x) + c.
>
> You still followed the precedece of * over +, I think it's even uglier:
> ((((a * x) ^ 2) + b) * x) + c
> Unless you were only talking about individual terms.
>
I didn't really follow the precedence - I just reduced the equation to a
non-ambiguous form... Well, almost. I should have written ((a*x)^2)+(b*x)+c.
As I wrote it originally, I suppose it could mean (a*x)^(2+(b*x)+c).
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3a80db3a$1@news.povray.org> , "Mark Wagner"
<mar### [at] gte net> wrote:
> I just typed the expression 1+2*3-4 into my TI-1795 calculator, and, as
> expected, got the number 5.
Yes, because you did not calculate the above! What you calculated* was :
1+2=3
3*3=9
9-4=5
Obviously this cannot be the same as 1+2*3-4.
Thorsten
* Your calculator manual will of course explain this exactly the same way.
However, most newer caclulators (and many expensive older ones) support
calculations in mathematical order (or whatever this is called).
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Thorsten Froehlich" <tho### [at] trf de> wrote in message
news:3a815c85@news.povray.org...
> In article <3a80db3a$1@news.povray.org> , "Mark Wagner"
> <mar### [at] gte net> wrote:
>
> > I just typed the expression 1+2*3-4 into my TI-1795 calculator, and, as
> > expected, got the number 5.
>
> Yes, because you did not calculate the above! What you calculated* was :
>
> 1+2=3
>
> 3*3=9
>
> 9-4=5
>
> Obviously this cannot be the same as 1+2*3-4.
>
>
Yeah, but the point is that 5 is just as valid a result as 3, for the
sum 1+2*3-4, if we ignore the 'accepted' operator precedence rules. We could
quite as easily have precedence rules that state that addition and
subtraction is done before multiplication and then everyone would be saying
"But it's not 3, it's -3!". Do you see ? All that makes 1+2*3-4 evaluate to
3, rather than -3, or 5, or -1 is an arbitrary rule about which order the
operations should be done in - change those rules and you change the
answer - but you don't change any fundamental aspect of mathematics.
There are, unless I've missed some, 5 ways (if we ignore standard
operator order rules) to interpret '1+2*3-4' :
(1+(2*(3-4))) = -1
(1+((2*3)-4)) = 3
((1+(2*3))-4) = 3
((1+2)*(3-4)) = -3
((1+2)*3)-4) = 5
These're all _mathematically_ correct statements, yet we only except one
to be the correct evaluation of '1+2*3-4'. This is not, as I've already
said, because any of the others are wrong, but merely because the statement
is ambiguous and we therefore need some way to de-ambiguate (choose) between
the possible interpretations.
--
Scott Hill.
NC Graphics (Cambridge) Ltd.
http://www.ncgraphics.co.uk
P.S. When will p.o-t be back ?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Scott Hill" <sco### [at] ncgraphics net> wrote in message
news:3a8167d3@news.povray.org...
>
> P.S. When will p.o-t be back ?
>
It is! (follow ups to ot.)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Scott Hill schrieb in Nachricht <3a8167d3@news.povray.org>...
> (1+(2*(3-4))) = -1
> (1+((2*3)-4)) = 3
> ((1+(2*3))-4) = 3
> ((1+2)*(3-4)) = -3
> ((1+2)*3)-4) = 5
>
> These're all _mathematically_ correct statements, yet we only except
one
>to be the correct evaluation of '1+2*3-4'. This is not, as I've already
>said, because any of the others are wrong, but merely because the statement
>is ambiguous and we therefore need some way to de-ambiguate (choose)
between
>the possible interpretations.
They are not mathematically correct, because an improtant part of the
mathematical system are the precedence rules. They are in no way more
arbitrary than any other mathematical rule, 'cause mathematics is no science
but just a set of rules which have at first nothing to do with any real
thing in the world (although they prove to be of much help to understand
some things in real world). If you just cancel one of the rules you can as
easily give up the whole system - or at least you have to say what you are
doing. The mathematical system in whole is not ambiguos at all - cause there
are rules to tell you how everything interacts which each other.
>P.S. When will p.o-t be back ?
>
Well, it is back for more than a week now.
Marc-Hendrik
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Marc-Hendrik Bremer" <Mar### [at] t-online de> wrote in message
news:3a816eb1@news.povray.org...
>
>
> They are not mathematically correct, because an improtant part of the
> mathematical system are the precedence rules. They are in no way more
> arbitrary than any other mathematical rule, 'cause mathematics is no
science
I disagree - for example I am not offended/shocked/suprised/whatever that
entering 2+3*5 in a calculator gives me 25 but gives me 17 in POV. However,
if a calculator or program ever told me that 3*5 was anything but 15, I
would ask for a refund.
IMHO you're missing the point. Precedence rules exist (once more with
feeling) because common-sense cannot resolve the issue.
Another English example - "rape" is both an act and a plant. If I say "there
is a lot of rape in Sussex" you have no way of knowing whether I mean the
plant or the act. The doubt can only be resolved by some extra words. For
example "there are many rape-plants in Sussex".
This is the linguistic equivalent of brackets in a function. For you to
argue that the meaning of * or + is just as arbitary as precedence is the
equivalent of me saying that "there is a lot of rape in Sussex" is as
ambivalent as "there is a lot of crime in Sussex" because, in some private
language of my own, "crime" also means "oxygen".
Yes, maths is arbitary, but so is English. Nevertheless "rape" is ambivalent
in a way that "crime" is not.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly <tom### [at] tomandlu co uk> wrote:
: I disagree - for example I am not offended/shocked/suprised/whatever that
: entering 2+3*5 in a calculator gives me 25
If I enter that in my calculator it gives me 17.
Why?
There are two (main) types of calculators.
Usually calculators only calculate one operation at a time. They do not
have memory for long expressions (some of these have indeed parentheses,
but still they work in the same way when parentheses are not used) and they
calculate every sub-expression right after it has been entered.
What happens when you type "2+3*" (yes, I left the '5' intentionally out)
is the following: The calculator gets a '2', then a '+', then a '3'. Now
it expects either a number or another key (such as '=' or another operator).
When it gets something that is not numerical input it immediately calculates
the result of the current operation (as if '=' had been pressed) before
continuing.
In fact, pressing any operator is like pressing '=' and that operator
(some very cheap calculators don't even have a '=' at all, but you have to
press some operator in order to get the result, such as '+'). Pressing the
operator is more like a shortcut for '=' and the operator itself.
This is most probably done for simplicity. Usually these kind of calculators
are used for very simple tasks, like adding the prices of some products
together and so on. Modifying the behaviour of the operator keys to work
in another way would most probably just confuse people.
When you type "2+4*5" you are, in fact, typing "2=+3=*5", although it's
kind of hidden.
Now, the most advanced calculators (mainly graphical ones, like mine) allow
you to actually write long expressions (the whole expression is shown on
the screen of the calculator) and the result is calculated only when you
press '=' (or usually 'enter' in those calculators).
These calculators also usually allow you to navigate through the expression
with cursor keys and make modifications to it.
(The most advanced allow you to enter more complex mathematical operations
such as summation, derivative and integrals. Mine does; it even shows them
in the same way as I would write them on paper.)
Since in these calculators you are actually calculating the result of the
whole expression, not just a sub-expression at a time, the result is the
mathematically expected one.
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>E.g, what does 1+2*3-4 evaluate to ?
11123-4
12222223-4
and so on
Basically one or more 1's followed by zero or more 2's followed by
'3-4'
It basically depends on the input string you are matching against.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Warp" <war### [at] tag povray org> wrote in message
news:3a81848c@news.povray.org...
> Tom Melly <tom### [at] tomandlu co uk> wrote:
> : I disagree - for example I am not offended/shocked/suprised/whatever
that
> : entering 2+3*5 in a calculator gives me 25
>
> If I enter that in my calculator it gives me 17.
> Why?
>
<SNIP>
Exactly - there is no wrong answer in the two answer, they are just using
two different conventions. However, to calculate the result on the basis
that "+" meant "/" would be silly.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly wrote:
> (a*(x^2)) + (b*x) + c - but this is not common sense, it is following a
> convention that exists because common sense is not available.
I don't know, it seems sensible to me. Addition versus multiplication: to me,
multiplying implies part of the same thing, like width and height of a
rectangle, whereas addition is the sum multiple things, ie multiple rectangles.
Think of the problem of surface area of a 3d solid. Hence multiplication
operations should be "groups" when figuring out the order of operations. It
gets progressively more obscure, but I think a similar arument can be made for
all precedences.
Besides from which, mathematics and programming require strict rules and some
degree of consistency by their very nature.
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly wrote:
> > NO!! 1+2*3-4 is three, only three, exactly three, no more, no less, and
> most
> > certainly not and NEVER five. If you meant (1+2)*3-4, that would be
> analagous to
> > me typing orange and meaning purple. Anyone who types 1+2*3-4 and expects
> 5 is
> > an idiot.
> >
>
> I disagree. Anyone who types 2*1.5 and expects 5 is an idiot. Typing 1+2*3-4
> and expecting 5 just means that they don't know the conventions. The
> conventions exist because intelligence alone cannot resolve the issue.
I still disagree. Mathematics REQUIRES conventionality. There can be NO
ambiguity in mathematics. It operates on the idea of proof through logic.
There are reasons for the order of operations. Every multiplication operation
takes parts of the same thing; length*width=area of *one* face on a cube, or
average_velocity*time=displacement. Addition and subtraction however take
multiples of something; you sum multiple faces to get the total surface area, et
al. Of course it is not always this simple, but that's why we use parentheses.
The parentheses show us clearly, visually and unambiguously that an operation is
being used as one piece in a larger operation.
If your calculator is giving you five it is merely a limitation of the
technology. The manual probably states clearly that five is techincally wrong,
and shows what the calculator is *really* doing. Any scientific calculator obeys
order of operations, and even the older ones will expect that you request the
result before the computation is complete. Instead the cheap calcs think you
want a result after every operation, then discard everything you typed in.
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"David Fontaine" <dav### [at] faricy net> wrote in message
news:3A81CCBB.635F3E91@faricy.net...
> Think of the problem of surface area of a 3d solid. Hence multiplication
> operations should be "groups" when figuring out the order of operations.
It
> gets progressively more obscure, but I think a similar arument can be made
for
> all precedences.
Well, yes, but obscure is the important point. Okay, you might be able to
make a clear arguement for * over + but what about - and + or / and * ?
There maybe an arguement, but it isn't a clear one. However, any arguement
that says 2*3 is not 6 is plainly batty.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly <tom### [at] tomandlu co uk> wrote:
> "David Fontaine" <dav### [at] faricy net> wrote in message
> news:3A81CCBB.635F3E91@faricy.net...
>> Think of the problem of surface area of a 3d solid. Hence multiplication
>> operations should be "groups" when figuring out the order of operations.
> It
>> gets progressively more obscure, but I think a similar arument can be made
> for
>> all precedences.
> Well, yes, but obscure is the important point. Okay, you might be able to
> make a clear arguement for * over + but what about - and + or / and * ?
> There maybe an arguement, but it isn't a clear one. However, any arguement
> that says 2*3 is not 6 is plainly batty.
Actually, there are plenty of number systems where this is plainly *not*
true. There are the simple systems where 6 is undefined (base 4, for
example, where 2+3 = 11, or the mod 5 number system, where 2*3 = 2) and then
there are more complex things, where the definitions which you use for the
multiplicative and additive operators get weird. I can't give a good
example here, since A. It takes a lot of math, and B. It's been close to a
decade since I did discrete algebra. How number systems behave is highly
dependant upon the assumptions you place upon them.
Now, if you're talking about the integer, rational, or real number lines,
then yes, 2*3 = 6. However, those are not the only number system available
to us. I use mod systems all the time in POV, for example.
Geoff
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Geoff Wedig" <wed### [at] darwin epbi cwru edu> wrote in message
news:3a829d42@news.povray.org...
> Tom Melly <tom### [at] tomandlu co uk> wrote:
> > There maybe an arguement, but it isn't a clear one. However, any
arguement
> > that says 2*3 is not 6 is plainly batty.
>
> Actually, there are plenty of number systems where this is plainly *not*
> true. There are the simple systems where 6 is undefined (base 4, for
> example, where 2+3 = 11, or the mod 5 number system, where 2*3 = 2) and
then
Well, yes, obviously if you use any other system than decimal, then all bets
are off. However, even recognising the validity of some of the arguements
put forward, I still find it remarkably obtuse to argue that precedence is
no more arbitary than what 1+1 equals (base 3 upwards ;)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly <tom### [at] tomandlu co uk> wrote:
> "Geoff Wedig" <wed### [at] darwin epbi cwru edu> wrote in message
> news:3a829d42@news.povray.org...
>> Tom Melly <tom### [at] tomandlu co uk> wrote:
>> > There maybe an arguement, but it isn't a clear one. However, any
> arguement
>> > that says 2*3 is not 6 is plainly batty.
>>
>> Actually, there are plenty of number systems where this is plainly *not*
>> true. There are the simple systems where 6 is undefined (base 4, for
>> example, where 2+3 = 11, or the mod 5 number system, where 2*3 = 2) and
> then
> Well, yes, obviously if you use any other system than decimal, then all bets
> are off. However, even recognising the validity of some of the arguements
> put forward, I still find it remarkably obtuse to argue that precedence is
> no more arbitary than what 1+1 equals (base 3 upwards ;)
Oh, yes. Precedence is a convention, not a base assumption of mathematics.
Precedence involves how systems of equations are written down, how they're
represented, not the equations themselves. The equations are what's really
relevant, not their representation. Representations have changed over the
years (the way Newton wrote out equations was *very* different from anything
we'd see today), but the math that was represented, that is what's
importatn, and that hasn't changed (well, been improved, modified, etc, but
nothing in it has become incorrect within its sphere)
Geoff
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2001-02-07 17:23, Warp <war### [at] tag povray org> wrote:
>Tom Melly <tom### [at] tomandlu co uk> wrote:
>: I disagree - for example I am not offended/shocked/suprised/whatever
>: that entering 2+3*5 in a calculator gives me 25
>
> If I enter that in my calculator it gives me 17. Why?
>
> There are two (main) types of calculators Usually calculators only .
> calculate one operation at a time .
I would debate the "usually" here. Every calculator I have ever bought
(starting with that TI-33 over 20 years ago) knew about precedence
rules. The cheap thingies built into mouse mats and rulers probably
don't but they don't have parentheses either (for the same reason -
parentheses require a deeper stack).
An interesting variation are some printing desk calculators, which use
infix operators for multiplication and division and postfix for addition
and subtraction. So to compute 2*3 - 4*5 you would type
CLR 2 * 3 + 4 * 5 -
> Now, the most advanced calculators (mainly graphical ones, like mine)
>allow you to actually write long expressions (the whole expression is
>shown on the screen of the calculator) and the result is calculated
>only when you press '=' (or usually 'enter' in those calculators).
The TI-33 didn't. It calculated each subexpression as soon as possible.
So if you type 2+3* it would notice that * has higher precedence than +
and throw 2+ on the stack. If you continued typing 5-, it would first
complete the multiplication (giving 15) and further check the stack
for pending operations. Since + has the same precedence as -, it would
perform the addition, too.
The stack had a limited depth (6 entries, I think), but I rarely
exceeded it. That wasn't a high-end calculator at that time, either, it
costed only a few hundred ATS - an HP-42 was about 10 or 20 times as
expensive, IIRC.
hp
--
_ | Peter J. Holzer | All Linux applications run on Solaris,
|_|_) | Sysadmin WSR | which is our implementation of Linux.
| | | hjp### [at] wsr ac at |
__/ | http://www.hjp.at/ | -- Scott McNealy, Dec. 2000
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly wrote:
> Well, yes, but obscure is the important point. Okay, you might be able to
> make a clear arguement for * over + but what about - and + or / and * ?
> There maybe an arguement, but it isn't a clear one. However, any arguement
> that says 2*3 is not 6 is plainly batty.
- and + are the same operation. / and * are the same operation. Well, they're
inverse, but to be inverse they must use the same stuff (ya know, like to be
opposites words must describe the same thing--hot and cold). -x = +(-x) and /x =
*(1/x). It wouldn't make any sense to do multiplaction then subtraction then
division then addition, or something like that.
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |