Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A simplier math formula
Message
From
17/12/2008 08:52:30
 
 
To
17/12/2008 05:48:56
General information
Forum:
Politics
Category:
Other
Miscellaneous
Thread ID:
01367448
Message ID:
01368087
Views:
7
Hey, great post Gregory. Now even I understand it.


>>>>>Was there ever a conclusion here as to what is correct?
>>>>>
>>>>>I would of done it like this:
>>>>>(-2)^2 = 4
>>>>>
>>>>
>>>>try:
>>>>
>>>>?5-2^2
>>>>
>>>>?-2^2
>>>>
>>>>obviously VFP and Excel has a bug.
>>>
>>>
>>>Metin,
>>>
>>>This is not algebra
>>>
>>>The minus sign in the first expression is a binary operator.
>>>In the second expression, it's a unary operator
>>>
>>>The unary minus has higher precedence than the exponent
>>>The binary minus has lower precedence than the exponent
>>>
>>>No bug
>>
>>you say
>>
>>?5-2^2
>>
>>different than
>>
>>?-2^2+5
>>
>>that can't acceptable...
>
>Metin,
>
>I'll try to explain to a top 1% mathematician about computer languages - not algebra
>I do not claim that this is complete - it's meant to help you understand
>
>If there are words you do not understand, try to find them here : http://www.thefreedictionary.com
>
>Operators
>--------------
>The arity (http://en.wikipedia.org/wiki/Arity) of an operator is the number of arguments it takes
>eg multiplication takes two arguments, a * b could be written as *(a, b)
>
>A unary operator takes 1 argument and its arity is 1
>a binary operator takes 2 arguments and its aritry is 2
>a ternary operator takes 2 arguments and its arity is 3
>a n-ary operator takes n arguments and its arity is n
>
>In essence, an operator with arity n is a function taking n arguments and returning exactly ONE result
>
>Prefix/postfix/infix
>Notation and operators:
>In a prefix notation, the operator is written before the argument, example from C#: ++i
>In a postfix notation, the operator is written after the argument, example 3! (where ! is factorial, ie 3 * 2 * 1)
>In an Infix notation, the operator is written between the arguments, eg : 1 + 2 or a * b
>
>
>Precedence
>The operators are assigned a precedence (sort of priority). Operators with higher precedence are evaluated before those with a lower precedence
>This is by convention. Without them we would be forced to write fully parenthesized expressions
>1 + 2 + 3 * 4 will be evaluated ((1+2) + (3*4))
>
>associativity
>If an operator is associative, eg (1+2)+3 = 1 + (2 + 3), it will be assigned a Left or a Right associativity
>Why is Left/Right needed ? Addition - for example - is an binary operator (Arity = 2, takes 2 arguments)
>
>1 + 2 - 3
>Since an operator is in essence a function that takes n arguments, would we write
>Plus(1, Minus(2, 3)) or 1 + (2-3)
>or
>Minus(Plus(1,2),3) or (1+2) - 3
>
>So, the associativity comes into play with operators of equal precedence (+ and -, * and -)
>
>unary minus                    Right
>exponent                          Right (vfp = Left)
>multiplication, division  Left
>addition, subtraction     Left 
>
>
>
>In the expressions below the minus sign is a unary operator, ie takes one argument
>[ remember that unary minus has higher precedence ]
>
>-3
>-2^2
>
>If we wrote it with functions
>
>Negate(3)
>Exponent(Negate(2), 2)
>
>
>
>Here, it takes two arguments and is a binary operator
>
>0 - 3
>0 - 2 ^2
>
>With functions
>
>Subtract(0, 3)
>Subtract(0, Exponent(2,2))
>
>
>How do we know that a minus is a unary operator ?
>A unary minus comes at the beginning of an expression or immediately after a left parenthesis
>
>Ok, time to do some work now
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform