Electronics > Beginners
Exponents
rstofer:
MATLAB:
>> -3^4
ans = -81
wxMaxima
(%i1) -3^4
(%o1) -81
GNU Fortran
Program Exponents
print *, -3**4
end program Exponents
-81
Symbolab.com
-3^4=-81
Of the math tools I am currently using, exponentiation has a higher precedence than the unary minus. This is what I expected. But it's nice to be certain!
metrologist:
--- Quote from: ebastler on April 09, 2019, 03:34:52 pm ---
--- Quote from: metrologist on April 09, 2019, 03:13:54 pm ---I'm sure the image below will illustrate another failure of applied context.
--- End quote ---
At the danger of repeating myself:
https://en.wikipedia.org/wiki/Order_of_operations#Unary_minus_sign
--- Quote ---Some applications and programming languages, notably Microsoft Excel (and other spreadsheet applications) and the programming language bc, unary operators have a higher priority than binary operators, that is, the unary minus has higher precedence than exponentiation, so in those languages −32 will be interpreted as (−3)2 = 9.
--- End quote ---
--- End quote ---
In the time it took me to make my post, and test Excel to see what it would do (because I have been merely aware of Excel's order of operations for many years, and had to see rather than recall it), you made your post above. I saw the red warning banner. I see it a lot, but am getting too lazy to go back and see what someone has posted. Usually it would not affect my post, so I would still post the same. In this case, I would have edited my post to acknowledge the redundancy I created, but is leaving myself open for you more enjoyable? I can't always be perfect.
This time, I see the red banner as I'm posting. I want to finish this post anyway, because I have another one open to add below. I probably will not have time to address those posts I've missed, sorry in advance...
--- Quote from: RandallMcRee on April 09, 2019, 03:58:20 pm ---Are you trolling? I ask because you put in a lot of stuff about your past performance but left out the most important piece of information that would allow someone to help you! I.e. What exactly are you confused about??
My guess is that you were never taught properly about operator precedence. It creates ambiguity in expressions like -3^4.
If you are actually still confused try to explain (in words).
--- End quote ---
I am not at all confused and not trolling. I wasn't confused last night when I started this topic. I was more frustrated that I got the wrong answer, as I should have known. I really do not recall how my first exposure to exponents was presented in school. I provided an example that makes it obvious in my follow-up post, and one that I'm sure is not ambiguous in an algebraic expression.
Anyway, I was confident that I'd learn more than I ever knew about operators by posting here, and I was curious how wrong I really was. I mean, if I walked up to an average engineer and just asked them what is minus two squared, or even wrote it down, how many would get it wrong too? I was never a practicing physicist or engineer. My life took a turn in another direction.
rstofer:
--- Quote from: metrologist on April 09, 2019, 08:42:32 pm ---Anyway, I was confident that I'd learn more than I ever knew about operators by posting here, and I was curious how wrong I really was. I mean, if I walked up to an average engineer and just asked them what is minus two squared, or even wrote it down, how many would get it wrong too? I was never a practicing physicist or engineer. My life took a turn in another direction.
--- End quote ---
You would probably get more wrong answers than you expect. It's not that engineers don't know operator precedence, it just doesn't come up a lot unless you do some kind of math that involves precedence. I'm sure if they sat down and thought for a few seconds, they would get the right answer but it would probably involve some conscious thinking, not just a quickie answer. They would have to mentally run through the rules.
I can tell you for a fact, at first glance, I'm not sure what answer I got. Sure, I know how it should work but I still have to stop and think. I don't rely on operator precedence, I use parentheses.
metrologist:
Operator precedence was the only thought on my mind. I even thought of this expression in parenthetical terms. I knew the point of the question, but did not arrive. That irritates me.
There is an adage, use it or lose it, and you are your own worst enemy.
I had to look these things up and now see terms like ngram (or is that n-gram?) that I do not recall. And what is an obelus, or what we know as a division symbol?
In some ways I feel a victim of the train me stupid system that is designed to achieve a certain objective, and in other ways I feel there are people who are born to be...
I do really appreciate everyone's posts here. Thank you.
soldar:
Excel gives different results for -3^4 (81) and for 0-3^4 (-81) which I find very strange. I don't know how they came up with that but I find it to be confusing and a bad idea.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version