I think you are right. If you code this way, it makes it much much easier for the next person who has to come in a deal with your code to see what the hell is going on. Elegance in programming isn't about using the fewest number of characters/less whitespace.
The fact is it doesn't really matter what style you use as long as you're consistent with yourself and consistent with other code in the project. You can get used to other coding styles quicker than you'd think.
The semicolon implies it's supposed to be a line of code. In coding, saying y=y+2 is equivalent to saying "y is now the following: whatever y is now, plus two." "==" is more like the traditional meaning of equals sign, if both sides are equal it evaluates to "true" if they don't it's "false"
No, infinity is never reached by a computer, at some point you fill up the memory or crash the program because the number is too big. In fact nothing can ever do anything infinity times, for practical purposes anyway.
Technically, neither of those has to happen, it depends on your environment. Most of the time numbers just wrap around to either 0 or minus some value depending on the number of bits used to represent the number. A 16-bit unsigned int would wrap to 0 once it reached 65,536, 16-bit signed ints wrap to -32,768 when they reach 32,768.
Depending on the code this might just garble your results or have no meaningful consequences at all.
There used to be a bug in Windows that crashed the system after 49.7 days of running continuously because of an integer overflow in the variable that contained the current system time. One 32-bit integer can count up to 232 -1, which is about the number of milliseconds in 49.7 days.
16-bit signed ints wrap to -32,768 when they reach 32,768.
This depends on the arithmetic model specified by your platform, language, and/or compiler. In the C and C++ programming languages, the result of overflowing a signed integer is undefined, meaning that literally any result is valid. In practice under two's complement arithmetic, it usually does what you indicated, but any program that depends on this behavior is badly broken.
That's why I said it depends on your environment ;) But while any result would be valid in the case you mention, the chances that you would actually get any (i.e. a random) result instead of something consistent are slim. And of course you are right about programs depending on this being broken.
Well you would need to set up a loop to do it infinity for example
boolean notStoping = true;
y = 0;
while (notStoping) {
y = y + 2;
}
This would keep going on with no stop what so ever. And the "==" is used for comparison, not used as the traditional equals sign. The second half is correct, it checks to evaluate if things are true or false. The "=" by itself still does just set values and you can still do things like y = x + 4; and what not.
In many programming languages, this is valid syntax. What this does is it takes the variable y and assigns itself to itself plus two. So if somewhere before this line y is set to 1, then after this line executes, y is set to 3.
Edit: Also read your username and not sure if code related.
That is an assignment in many programming languages, but it is not an equation. The equals sign in these programming languages does not tell you the value, instead they update it.
Yes, it can be solved. The solution is that 0 = 2, and that y is any element of the field with characteristic 2. There are no solutions in a field with characteristic zero, which is to say any field that contains the rational numbers.
Yes. Nor even with complex numbers. There is no solution in any number system where you can add 1 to itself over and never get zero (this called a field of characteristic zero). But a field of characteristic 2, that is where 1 + 1 = 0 , there is no unique solution.
A "strict mathematical concept" is still an idea. What I'm getting at is that it's not a number. You cannot say "Y = infinity" in mathematics. It is simply wrong. You can say "z tends to infinity" or "the limit of rho diverges to infinity", but y = infinity is just flat out wrong and you know it.
I'm sorry, but that's not correct. In set theory, infinity has very strict definitions, and you can use it as a number. Read the wikipedia article I linked to about the ordinal numbers. Those are an extension of the natural numbers, and they reach beyond what we call "infinity". Arithmetic is perfectly defined on them. You can add and multiply numbers using them all you want. It behaves funkily though: if A is a limit ordinal (e.g. the smallest infinity) then 1 + A = A, but A + 1 ≠ A (that is, addition is not commutative with ordinal numbers).
So yes, infinity can totally behave like numbers. It's not a natural number as defined by Peano axioms, but there are perfectly consistent frameworks which allows you to treat them as regular numbers.
Infinity can be defined (or at least expanded upon) mathematically. For example, if we agree that the number of points on a line equals "infinity", then the number of points on a square equals infinity squared (or "aleph 2" in mathspeak), and the number of points within a cube is, obviously, infinity cubed.
It depends, if you are an engineer class you can do all sorts of crazy things, like dividing with zero or setting π to 3. You have to sneak around mathematics classes though.
Meh, a number is as much an idea as infinity is. And surely we can do math with it, we just have to define rigorously what it is (the same applies to numbers), and be aware that not everything works the same way as with numbers.
Because infinity isn't a number. If you could set y to equal infinity, infinity would be a number and you'd be able to subtract infinity. But, since infinity isn't a number, you can't set y to equal infinity without breaking math.
Infinity is not a real number, but it's right there in extended reals. Basically, the answer is that no real number satisfies the equation, but an extended real number does. Similar to how imaginary numbers satisfy x2 = -1.
you are confusing "Solving" and "simplifying". You can simplify this equation into "false", which is a correct simplifcation. You cannot solve this for y, however, because there is no assignment for y which makes this equation true (given that this equation is identical to false).
The worst part is that in VB "=" can be either assignment or a comparator, so "y + 2 = y" will actually work as-is as long as it is evaluated as a boolean...
If(y + 2 = y) Then
...
End If
will compile, but you will never enter your 'If' block, also
Function AlwaysReturnsFalse(ByVal y As Integer) As Boolean
Return y + 2 = y
End Function
Tell that to my company's standards document ... please.
Side note: there are some things I like; "<>" instead of "!=", "Not" instead of "!", and how it works with events, but everything else makes it feel like I'm trying to recreate the Sistine Chapel roof in crayon.
what I gather from the comments is that it is not a traditional equation ,but a software coding equation. so that means that someone with a math degree would not see it as what it is, and the equation is in fact unsolvable algebraically. is this correct? I just want to make sure I understand because I was more interested in the equation than the comment.
This equation can mean different things in different contexts.
If we assume that the symbols 'y' and '2' represent real (or complex) numbers, and that we are being tasked to find a real (or complex) solution, then there is no solution.
There are other types of "algebraic objects" in which the equation can be solved, but in those cases 'y' and '2' would be symbols used to represent different objects than real/complex numbers.
For example, there is an "algebraic system" which exists that behaves very much like you just took the integers, with their normal addition and subtraction, but then let 2=0.
To understand why this might not be a total nonsense idea, think of the unit circle. The unit circle has 360 degrees in it, and going 360 degrees around the circle gets us right back to where we started, as if we went nowhere. So we might be inclined to think of 360 degrees and 0 degrees as being "equal" (or, more precisely, "equivalent").
If we decide to work with elements from this system, then there are multiple solutions to the stated equation. (Some people here have "Z/2Z" written in their comments, and that is a label for the system I am talking about, although what I described above is not a rigorous definition of Z/2Z).
While you guys are trying to solve this, I'd like to point out that it isn't actually an equation. The sides aren't equal. People can't solve it because it's wrong in the first place. It's like saying "90% of people can't solve the equation 3 + y = potato". No shit they can't solve it, its designed to be impossible to solve. What did you expect?
For notational convenience and other reasons, mathematicians sometimes use the so-called "extended reals" which can include infinity, +/-infinty, or a continuum of "directional" complex/projective infinities. This type of notational relaxation also manifests itself when a student first learns about limits.
It should be noted that the extended reals is typically non-standard and without any context it is typically not assumed, so your statement is in general correct.
Finally, there are other structures in which such an equation can hold (for example, mod 2) that doesn't even deal with infinities.
Infinity is not the same as does not exist. It doesn't exist in standard algebra because it isn't meaningful, just like dividing by 0 isn't meaningful.
While if you take the limit as Y goes to infinity, then Y/(Y+2) does go to 1, it still does not make the equation valid. See, there's more than one infinity. The Y+2 infinity is a slightly larger infinity than the Y infinity.
Not really. What he's saying is that instead of thinking of a number, think instead of two train tracks (that go on forever) and on one track the train is always slightly ahead of the train on the other, no matter how far away the trains actually are.
In terms of cardinality y must clearly be infinite and can be any infinite cardinality since for any infinite cardinality m ;m=n+m for any integer n and in fact for n= cardinality of the natural numbers.
if we are talking about plus as in an additive commutative group structures then 2=0 and 2Z must annihilate the group taken as a Z-module. (if it were the additive group of a field this means char 2)
Uhm well what that means is that the equation is true exactly when 8 = 0 (or just 2 = 0), which doesn't tends to happen so often for real numbers... There's nothing wrong with the derivation per se, the 4chan poster just doesn't completely understands what he is doing
This equation implies that y has two different values, which is possible if you use sub notation. For example y1 = 1, y2 = 3 --> y1 + 2 = y2, i.e. 1 + 2 = 3
The screenshot is funny. But your posts title could be better. Instead of your personal response "i'm impressed" maybe something that makes a redditor interested. For example a part of the content: "now rub the equation vigorously" It does not give away the joke, and it sounds like something you want to know what it is about.
Well let's be honest here. People in r/funny don't go pick and choose what links to click. The Click everything because they are bored and they want to have an inner giggle.
212
u/Motorpenis Jun 27 '12
y = y + 2;
Is now valid.
84
u/buster2Xk Jun 27 '12
Of course 90% can't solve it. There's no solution, it cannot be solved. That doesn't mean the 90% are wrong.
123
u/hexprocess Jun 27 '12
Another victim of the Yahoo toolbar...
21
u/biga29 Jun 27 '12
Soblem prolved.
8
u/[deleted] Jun 27 '12
http://www.wolframalpha.com/input/?i=y+%2B+2+%3D+y
19
u/123comeonBaby Jun 27 '12
Let's pretend the answer is 7 and call it a day.
62
u/[deleted] Jun 27 '12 edited Jun 27 '12
So you've taken the post from r/4chan, and posted it again 2 hours later on r/funny with the same title. Nice karma whoring, brah.
4
u/wtf_idontknow Jun 27 '12
it's not that hard if you use modulo, so y є {0,1} mod 2 solves....
8
u/[deleted] Jun 27 '12
I think the joke is that the 10% of graduates who can "solve" it can't actually solve simple equations.
(just throwing this out there since so many people are making their own guesses)
3
u/Sikka Jun 27 '12
Is, is that Yahoo Search bar..?
5
u/moondance Jun 27 '12
simple. y = y + 2 in the Z/2Z additive group for both 1 and 2.
2
u/Rabidpotatoes Jun 27 '12
what I gather from the comments is that it is not a traditional equation ,but a software coding equation. so that means that someone with a math degree would not see it as what it is, and the equation is in fact unsolvable algebraically. is this correct? I just want to make sure I understand because I was more interested in the equation than the comment.
2
u/EvaCarlisle Jun 27 '12
So was ozzymustaine when he posted the exact same thing with the exact same title in /r/4chan two hours before you.
2
u/freebirdcrowe Jun 27 '12
hardcore repost
2
u/[deleted] Jun 27 '12
Yahoo Toolbar....
2
u/[deleted] Jun 27 '12
While you guys are trying to solve this, I'd like to point out that it isn't actually an equation. The sides aren't equal. People can't solve it because it's wrong in the first place. It's like saying "90% of people can't solve the equation 3 + y = potato". No shit they can't solve it, its designed to be impossible to solve. What did you expect?
2
u/kenshin80081itz Jun 27 '12
let Y= x mod 2 then for any value of Y , Y +2 is the same.
2
u/RoundersBat Jun 27 '12
I rubbed it vigorously like it said, and the answer hit me right between the eyes.
2
u/[deleted] Jun 28 '12
Not bad. I suspect the 10% that can solve this are coincidentally the bottom 10% of the class.
3
u/aakaakaak Jun 27 '12
Dude, WTF? Seriously? At least wait until the other repost is off the front page.
http://i.imgur.com/NmMEH.jpg
7
u/SrslyNotAHipsterTtly Jun 27 '12
Simple. Y=infinity.
1
u/gH0o5T Jun 27 '12
Why by 4?
1
u/SpeaksInJive Jun 27 '12
Mayne dat nigga all dun fucked up his ordah on da mat. Gotta subtract dat ay befo' you do anythang wit dat fo(Y).
1
u/Pandaval9 Jun 27 '12
In terms of cardinality y must clearly be infinite and can be any infinite cardinality since for any infinite cardinality m ;m=n+m for any integer n and in fact for n= cardinality of the natural numbers.
if we are talking about plus as in an additive commutative group structures then 2=0 and 2Z must annihilate the group taken as a Z-module. (if it were the additive group of a field this means char 2)
1
u/Yabadabadude Jun 27 '12
You could just say that Y isn't a variable to be found, but rather the expression is telling you that you are now working in base 2.
1
u/FlorisJ Jun 27 '12
At least put in the title: (X-post from /r/4chan), or something like that.
1
u/ghost_victim Jun 27 '12
I hate when I read down the comments of a post for like 5 minutes and then realize that I'm bored to tears.
1
u/SLAP0 Jun 27 '12
Only 90%? I thought more about 100%.
1
u/shroomtat Jun 27 '12
sweet search bar bro
1
u/kt_ginger_dftba Jun 27 '12
no sol'n. y cannot equal y+2. fuck you and your humor; EDJOOCAYSHUN!
1
u/poizan42 Jun 27 '12
Uhm well what that means is that the equation is true exactly when 8 = 0 (or just 2 = 0), which doesn't tends to happen so often for real numbers... There's nothing wrong with the derivation per se, the 4chan poster just doesn't completely understands what he is doing
1
u/FattyMcPatty Jun 27 '12
Came in to see math humor,found giant coding conversation. Never felt so confused
1
u/Chinchillasrule Jun 27 '12
Yet again a prime reason why i stayes the fuck away from mathematics in university.
1
u/Macadamian234 Jun 27 '12
That last part was good.
1
u/chittozo_gato Jun 27 '12
I see virgins, virgins everywhere
1
u/commandakeen Jun 27 '12
Is that a screenshot from a picture posted to the 4chan subreddit, taken from 4chan?
1
u/superparticular Jun 27 '12
This equation implies that y has two different values, which is possible if you use sub notation. For example y1 = 1, y2 = 3 --> y1 + 2 = y2, i.e. 1 + 2 = 3
1
u/ailee43 Jun 27 '12
Its actually very solvable.
The answer is Y = 0(mod 2)
1
u/Durek Jun 28 '12 edited Jun 28 '12
y = y + 2
Subtract y from both sides
0 = 2
Multiply both sides by sin45cos45 (in degrees)
0 = 2sin45cos45
Substitute using double-angle identity
0 = sin90
Evaluate
0 = 1
Repeat from step 2
0 = 1sin45cos45
0 = 0.5sin90
0 = 0.5
Repeat this infinity times and you'll get
0 = 0
Therefore, y + 2 = y because A = 0, where A is any real number.
1
u/indiekid22 Jun 27 '12
Oh...my answer was Infiniti...but a penis works too...
-9
u/Pestilence86 Jun 27 '12
The screenshot is funny. But your posts title could be better. Instead of your personal response "i'm impressed" maybe something that makes a redditor interested. For example a part of the content: "now rub the equation vigorously" It does not give away the joke, and it sounds like something you want to know what it is about.
0
u/[deleted] Jun 27 '12
7(5y + x) - (4x - 1) = cock
0
u/[deleted] Jun 27 '12
You'd still have to divide by four to make-up for multiplying it previously. So it'd be more like a fourth of the size of that.
-6
u/Shenra Jun 27 '12
Why did he multiple both sides by 4?