The Godfather talking
You may crack software. How about me?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 08:03:20 08:03


Login with username, password and session length


Pages: [1]
Print
Author Topic: How would you evaluate this expression  (Read 4830 times)
0 Members and 1 Guest are viewing this topic.
Sideshow Bob
Cracking Team
Hero Member
****
Offline Offline

Posts: 1001

Thank You
-Given: 231
-Receive: 983



« on: September 26, 2023, 01:31:58 13:31 »

Ok so if a person wrote this down on a piece of paper this expression
-22
How would you evaluate it
would it be as -(22)=-4
or (-2)2=4
I am in =4 camp. because I read it as minus two squared. If I was to type this into my HP50g or the windows calculator I would key in 2+(+/-)+X2. But if you try the google calculator you will get -4. It will also depend highly on what brand of scientific calculator you have. If you write it out on paper. It looks like people in North America will say -4 because at least up to high-school they learn to follow a very strict PEMDAS regime https://www.mathsisfun.com/operation-order-pemdas.html
But in other countries it is learned the unary minus operator negates the value of the operand so it is  (-2)2=4. What do you think? But please bury any flamethrowers in the discussion. It will depend on many factors
Logged

I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum
Parad1gm
Newbie
*
Offline Offline

Posts: 18

Thank You
-Given: 20
-Receive: 14


« Reply #1 on: September 26, 2023, 02:28:19 14:28 »

I was raised using the BEDMAS system and seeing as the "-" is in front of the 2 without a bracket that is -2.  Even -(22) is wrong because it should read -1 x (22) (Can't really have a - in front of a bracket without some number)

Logged
Catcatcat
Senior Member
****
Offline Offline

Posts: 432

Thank You
-Given: 284
-Receive: 1653



WWW
« Reply #2 on: September 27, 2023, 07:02:32 07:02 »

This should be understood as the number minus two squared. Those, the number minus two must be multiplied by the number minus two and this is equal to four.
-22 = 4
Logged
Sideshow Bob
Cracking Team
Hero Member
****
Offline Offline

Posts: 1001

Thank You
-Given: 231
-Receive: 983



« Reply #3 on: September 27, 2023, 09:02:13 09:02 »

Even -(22) is wrong because it should read -1 x (22) (Can't really have a - in front of a bracket without some number)
I am not sure I follow what you are saying here. So you are saying -(-3-4) has to written as -1*(-3-4). That was new to me, although purely mathematical both expressions are correct and equal. And also google calculator accept both and give 7 as answer 
Logged

I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum
Parad1gm
Newbie
*
Offline Offline

Posts: 18

Thank You
-Given: 20
-Receive: 14


« Reply #4 on: September 27, 2023, 05:35:15 17:35 »

We have adapted -( as a short hand for -1 * (.  When learning order of operation the teach explicitly explained that was the case.
Logged
2Code
Junior Member
**
Offline Offline

Posts: 56

Thank You
-Given: 10
-Receive: 238


« Reply #5 on: September 28, 2023, 08:42:30 20:42 »

From 100 years ago I remember something like below, 1 is put there just to be more logic when you multiply with the sign, most of the time is not used. Maybe some education system have different methods for it
-22=(-1)*(2)2 =(-1)*2*2=-4
(-2)2=(+1)*(-2)2=1*(-2)*(-2)=4
Logged
Magnox
Senior Member
****
Offline Offline

Posts: 250

Thank You
-Given: 986
-Receive: 285


Oink!


« Reply #6 on: September 30, 2023, 12:09:05 00:09 »

From my learning I agree with 2Code (-22 = -4), although I've certainly come across the opposite perspective where a negative sign alone preceding a number is taken to be part of the number, not an operator. That's what causes the confusion/difference. It should always be treated as an operator (written as just - instead of -1* for short).

Qalculate gives the correct answer of -4; it even helpfully expands it as: -2^2 = -(2^2) = -4.
Excel gives an incorrect answer of 4 for -2^2. MS is aware of this... their answer is basically that Excel is for accountants, not mathematicians  Roll Eyes

Parentheses are our friends  Grin
« Last Edit: September 30, 2023, 12:21:23 00:21 by Magnox » Logged
Vineyards
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 64
-Receive: 37


« Reply #7 on: April 25, 2024, 07:50:46 07:50 »

I am not a mathematician, but we need to consider mathematics as a set of methods agreed upon by people to ease certain aspects of quantifying objects, understanding their magnitudes, etc. Several number types are used, and negative numbers are not considered natural. They were historically needed to demonstrate, for example, the balance of accounts between entities or persons. Bookkeeping runs around a set of agreed-upon rules, and whatever is represented here doesn't have to make sense, it is just how you regard it. There are many more methods where having both positive and negative numbers help people keep track of things.
Logged
OscarH
Junior Member
**
Offline Offline

Posts: 50

Thank You
-Given: 158
-Receive: 18


« Reply #8 on: April 25, 2024, 10:17:12 10:17 »

To what I remember, and Wiki confirms that, there are differing conventions concerning the unary operation '−' (usually pronounced "minus").
In written or printed mathematics, the expression −3² is interpreted to mean −(3²) = −9
Now, it appears some programming languages consider the 'minus' sign is part of the number, thus taking the square of this number is always a positive number...

IMO, the question is there only to highlight the risk of misunderstanding in between people, and in any case, it would had been better to add parenthesis i.e. (-3)² or -(3²).

https://en.wikipedia.org/wiki/Order_of_operations
Logged

All mushrooms are edible. At least once...
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC