Your original statement was that a logical expression by itself equates to true. My example, False, is a logical expression that does not equate to True, i.e. False != True. The expression False != True is True, that is why I said it.
JavaScript isn't the only programming language that has to deal with IEEE float NaNs
Mujapro ยท 16 points ยท Posted at 21:46:22 on May 9, 2015 ยท (Permalink)
I also initially thought this is a JavaScript bug / weird behaviour, but thank to your comment I actually looked it up and tested. In Java/Scala, Go and C (and probably all other languages) this holds true: (NaN == NaN) == false
Yup. If something that yields a value that that is not a number, it doesn't necessarily mean that it is equivalent to a similar expression. The problem isn't that NaN == NaN doesn't evaluate to true. The problem is that the comparison doesn't yield an indeterminate value. It's possible that the two expressions could be equal. It's possible that they are not. There's no way of knowing with the given information. The lack of three-valued logic in most programming languages upsets me.
winsuck ยท 4 points ยท Posted at 01:18:35 on May 10, 2015 ยท (Permalink)
I mean, realistically if else handles the idk. The else is literally saying whether it's false or not, as long as it isn't true to any of the prior ifs, do this. Booleans just need a "?" possibility.
I see what you're saying. One could check for values that yield indeterminate values in an expression. But that could get messy or at least confusing. Most programmers think with two-valued logic. If an expression isn't true, they'd assume it's false. So throwing the indeterminate case into the else statement, though technically correct, could introduce some bugs. The issue you brought up could be fixed by putting the idk case before the else statement.
if (some_expression) {
// do something
} idk {
// run around in circles while the world goes up in flames
} else {
// do something else
}
But what if you want the same thing to happen for the idk and else structures? Make a new function for even the most trivial of blocks? It'd be nice to have a way to combine the two. So perhaps a switch statement with a new keyword would be ideal for three-valued (or even n-valued) logic.
switch (some_expression) {
case true:
// do something
break;
case unknown:
case false: // (or default:)
// do something else
}
The problem here is that the switch expression is compared for equality (i.e. some_expression == true or some_expression == unknown or some_expression == false). The second would be indeterminate in itself. It's an interesting issue. I suppose a construct could be added for determining determinateness (e.g. isUnknown(some_expression)). But I'm sure there is a more elegant solution than the ones I have presented.
It would be a rarely used feature, but one of those nice to have features when in fact needed.
The issue you brought up could be fixed by putting the idk case before the else statement.
Eh, it wouldn't really matter much except for syntax parsing. In the end, it would probably not be used to much regardless because there's not terribly many cases where you're working with a nondeterministic if condition in practical use as you said.
But what if you want the same thing to happen for the idk and else structures?
For that, I would just have the interpreter/compiler assume you want the block to function as a normal "if/else" as they work now (if true, else false or unknown). I don't necessarily think some_expression == unknown is indeterminate if boolean allows for an unknown value.
But if you want to see something like that supported, one of the best ways is to make your own language (or change an existing language to support it). Sillier languages have been created for worse reasons, I guarantee it.
I'm taking a formal languages class and an operating systems class next semester and then a programming languages class the following semester. :)
I don't necessarily think some_expression == unknown is indeterminate if boolean allows for an unknown value.
Well, the unknown keyword would represent some unknown value, not a particular unknown value (think in terms of the integer equivalents of true and false). I think comparing to unknown should always be indeterminate. For example, what if you try comparing an integer to the integer representation of unknown?
What's the integer representation of true? The only reason it's "anything but 0" in many languages is because it's easy and fits the desired functionality. Why is 0 any less truthy than 2, or "" less truthy than "a"? There's convenience arguments but that's about it. Testing against "true" isn't against a specific true value, just the boolean idea of true and with trinary booleans (true, false, unknown) you're just checking against the boolean idea of unknown.
However, I counter your last example with, "why are you turning booleans into integers in the first place?" That sounds like some hacky shit right there.
As far as the truth of an integer goes, I think the integer representations originate from physics. If an object is at rest, its velocity is zero. The question is, "Is the object in motion?" The answer there unto is the answer to the question, "Does it have a nonzero velocity?" So zero is false and anything else is true. This applies to pretty much any physical quantity (e.g. voltage, current, energy, etc.). I agree that this is a semantic issue though. The question asked could just as easily be, "Is the object at rest?" For example, I know off hand that sh (and its derivatives) use 0 to represent truth and anything else to represent non-truth. It just asks the negation of what would typically be asked (in the interest of quantifying false values).
In either case, an indeterminate state of motion or rest would mean that you don't know if the velocity is 0, 1, -5, etc. (omitting units). It doesn't really matter how the question of its velocity is phrased because it cannot be certainly answered with boolean logic.
Why are you turning booleans into integers in the first place?
It has to be stored in memory somehow. But I think it's more critical to think of how to translate integers to boolean values (or some other logic system). The only value(s) that would generate an indeterminate state in ternary logic is simply not knowing what value you're working with.
"" less truthy than "a"
I don't think it necessarily is less valid. I think that a system for deciding the validity of strings was created for convenience just as systems for deciding the validity of integers was created.
I actually don't even think that values should have inherent validity. How can the value be true if there is no question being asked? It's not an answer if it's not a response to a question. The question would be, "If some_expression?" That just doesn't make sense. If some expression what? Sure, if some_expression is a boolean value, there doesn't really need to be question since you already have the answer. But that shouldn't apply to other types. While many would roll their eyes at this, I would like a language that forces a question to be asked (i.e. a comparison operation). At the risk of contradicting myself, back to the memory remark I made, the processor can store the boolean value in memory however the processor sees fit, but it should be invalid to interpret that as another type just as it is to interpret an integer as a set.
For what it's worth, even in SQL which is one of the few languages that do have three-valued logic, null is falsy (except in CHECK constraints). I can't see any reason why you couldn't have a three-branched IF, with a true, false, and a null branch, though.
Just imagine... Just for a single second, that instead of mathematics we did engineering, science and logic all through JavaScript. Just... let that sink in.
Negima! Magister Negi Magi, known in Japan as Magical Teacher Negima! (Japanese: ้ญๆณๅ ็ใใฎใพ!, Hepburn: Mahล Sensei Negima! ?) is a manga series written and illustrated by Ken Akamatsu, known for his best selling title Love Hina. It was serialized in Weekly Shลnen Magazine from 2003 to 2012, with the chapters collected into 38 tankลbon volumes by Kodansha.
Negima has been adapted into two television anime series, the first created by Xebec aired in the first half of 2005 and followed the manga, while the second is an alternate retelling of the series by Shaft titled Negima!?. In addition to four different sets of original video animations and an animated movie, a live-action television series has also been produced. The manga was being translated into English and published by Del Rey Manga in the United States and Canada until Kodansha established a U.S. division in 2010 and finished the release, while the series is licensed for distribution in the United Kingdom by Tanoshimi. Both anime and the second OVAs were licensed and dubbed in English by Funimation in North America.
Akamatsu collaborated with an artist named Yui to write the spin-off Negiho in 2010. In 2013, Akamatsu began a sequel/spin off titled UQ Holder! that focuses on Negi's grandson, Tลta Konoe, and follows a more science fiction/action oriented plot.
Don't think I did. I will have to reread it and see. I did like the story, but grew impatient waiting for it to come out -- I like binge reading a lot more. Maybe I will check it out again.
Strictly speaking, that's an expression but not an equation.
fb39ca4 ยท 59 points ยท Posted at 19:50:22 on May 9, 2015 ยท (Permalink)*
Most orgasprogramming languages only have expressions, not equations. The == operator simply gives you an expression that evaluates to true when the operands are equal, and false otherwise.
nermid ยท 3 points ยท Posted at 23:15:59 on May 9, 2015 ยท (Permalink)
Like sex, programming involves loads of meticulous preparation and study, followed by a few minutes of flailing around like a dying fish, finding out it didn't work at all, and then being disappointed in yourself.
My personal experience tend to differ a bit from yours, but have an upvote for this beautiful comparaison.
nermid ยท 2 points ยท Posted at 02:17:33 on May 10, 2015 ยท (Permalink)
It's not a perfect analogy, of course.
I'm getting better at programming.
LarsP ยท 3 points ยท Posted at 07:22:31 on May 10, 2015 ยท (Permalink)
Even casually speaking, that is not an equation.
Aydoooo ยท -6 points ยท Posted at 19:12:50 on May 9, 2015 ยท (Permalink)
x = x; isn't an equation either.
GMJack ยท 19 points ยท Posted at 19:20:44 on May 9, 2015 ยท (Permalink)
by definition I believe it is:
equaยทtion
ษหkwฤZHษn
noun
MATHEMATICS
a statement that the values of two mathematical expressions are equal (indicated by the sign =).
synonyms: mathematical problem, sum, calculation, question
"a quadratic equation"
2.
the process of equating one thing with another.
"the equation of science with objectivity"
synonyms: identification, association, connection, matching; More
Correct me if I'm wrong though I'm fully wiling to accept that it isn't an equation. It can be considered the simplified form of:
10x = 100x * 1/10
if it so wished.
dingari ยท 12 points ยท Posted at 19:38:16 on May 9, 2015 ยท (Permalink)
The semicolon gives away that it's an assignment, but not an equation.
GMJack ยท 6 points ยท Posted at 19:56:23 on May 9, 2015 ยท (Permalink)
0_0 I did that out of habit lol guess not.
Aydoooo ยท 15 points ยท Posted at 19:25:15 on May 9, 2015 ยท (Permalink)
I'm assuming (we are on /r/ProgrammingHumor) he meant "x = x;" as a piece of code just like you'd write in programming languages such as C or C++ etc. In that case, "x = x;" is an assignment, not an equation.
Probably. x==x is really just syntactic sugar for some equality call. I suppose if your compiler/interpreter is paying attention might just change it to "true", but that's the kind of scenario where weird bugs that no-one understands start popping up.
Most compilers will do two things when they see something like if (x==x):
They will give you a warning that your conditional is always true, since there's no point to have a conditional if it will always be one of true or false.
It will optimize away the call like you said to simply be true so that it will never actually have to evaluate the comparison when it runs
Technically, in some languages if do an an assignment in the if_conditional (hence the rationale of yoda conditions), it will evaluate to be true, and when you reach
boolean;
The value of x will be 7.
za72 ยท 1 points ยท Posted at 20:13:26 on May 9, 2015 ยท (Permalink)
If I'm not mistaken, this mostly happens in C-style languages where anything that isn't strictly false (0/null) is evaluated as a true in if statements. (This allows for fast comparisons using the processor's zero flag)
Since assignment returns the value of the assignment (allowing a = b = 7 to work properly) it evaluates to non-false and goes through.
za72 ยท 1 points ยท Posted at 20:49:28 on May 9, 2015 ยท (Permalink)
So the if statement is used to assign value to a variable and return a true condition, is this used for if else conditions? I'm not seeing any other use if we never end up testing or using the value of x...
It's not necessarily meant as an actual feature--it's just a rather interesting interaction between two separate language features that ends up working together in that way. I'm sure there's some strange situations where it would be useful for actual code, but I can't quite think of any right now.
Mostly it just ends up being a problem for beginning C programmers that come from languages that use a single '=' as the comparison operator.
qm11 ยท 3 points ยท Posted at 21:51:54 on May 9, 2015 ยท (Permalink)
I've used it in the following general structure:
while(rv = foo()) {
// do something with rv
}
The loop runs until foo() returns 0. You could also do code like:
while((rv = foo()) == 0) {
// ...
}
// do something with rv
This loop would run until foo() returns something other than 0. It's generally useful when you want to assign a function's return value to a variable, and check the value of that variable at the same time. Whether it's good style or not is up for debate.
Much of my work has come from being lazy. I didn't like writing programs, and so, when I was working on the IBM 701, writing programs for computing missile trajectories, I started work on a programming system to make it easier to write programs.
-- John W Backus, creator of Fortran, the first full compiled language.
omegian ยท 35 points ยท Posted at 21:31:00 on May 9, 2015 ยท (Permalink)*
Writing a program clever enough to allow others to be lazy isn't really a lazy job.
[deleted] ยท 90 points ยท Posted at 22:56:12 on May 9, 2015 ยท (Permalink)
Laziness in programming isn't the same as normal laziness.
nermid ยท 37 points ยท Posted at 23:24:52 on May 9, 2015 ยท (Permalink)
Right. There is a big difference. Lazy is not wanting to do a task. Efficient is not having to do any task more than what's necessary. Even when it means more works up front.
Ph0X ยท 10 points ยท Posted at 22:16:44 on May 9, 2015 ยท (Permalink)
Yeah, my guess is that it was a fun last question to see what crazy sort of stuff some kids come up with, and it probably didn't really count for any points.
You only think it's condescending because you have literally no context on both the test and the relationship between the student and teacher
Kyyni ยท 1 points ยท Posted at 09:27:50 on May 10, 2015 ยท (Permalink)
For all we know, he might have still gotten full marks on that one, the "really?" could just be a humorous, snarky remark, part of the student/teacher dynamic.
I know I always left snarky remarks for my philosophy teacher on any questions even slightly ambiguous, and she wrote snarky comments back, but still gave my full points where I deserved it. And don't even get me started on my maths teacher, if someone who didn't know what was going on took a look at our conversations, they could have mistaken them for a raging of fights one-upmanship over who was more right on a subject, but we both had fun, and I got good grades.
[deleted] ยท 2 points ยท Posted at 01:29:25 on May 10, 2015 ยท (Permalink)
Notice the question isn't marked wrong.. They simply wrote "Really?" on the paper. How can you make such an accusation without knowing any of the context?
salgat ยท 2 points ยท Posted at 22:00:04 on May 9, 2015 ยท (Permalink)
I'm going to go ahead and say you'd have to be pretty simple to not understand the intent of the question. Look up the definition of "smartass".
[deleted] ยท -3 points ยท Posted at 19:21:14 on May 9, 2015 ยท (Permalink)
[deleted]
[deleted] ยท 4 points ยท Posted at 19:48:40 on May 9, 2015 ยท (Permalink)*
[deleted]
Guyag ยท 2 points ยท Posted at 19:57:01 on May 9, 2015 ยท (Permalink)
Oh fair enough, misinterpreted
erilol ยท 1 points ยท Posted at 20:38:49 on May 9, 2015 ยท (Permalink)
Upvoting because your misunderstanding and the subsequent clarification contribute to the thread.
Most people don't get that a well-meant, constructive but incorrect statement is more valuable than a rah-rah statement, and insipid try-funny statement, or a tangential Simpsons quote in terms of value to the conversation, and sadly they'll upvote crap and downvote useful contributions.
While "Upvoting because" comments are typically also non-contributions to the conversation, this one appears to be made with the intention of contributing to ideas that I also would like to support.
[deleted] ยท -31 points ยท Posted at 17:49:23 on May 9, 2015 ยท (Permalink)
I hold that a student's duty is not to get as many points with as little work as possible, a student's duty is to learn and demonstrate learning. If you fail to interpret the question in a way that allows you to demonstrate learning, you do not deserve any points.
I applaud the teacher.
[deleted] ยท 23 points ยท Posted at 17:55:10 on May 9, 2015 ยท (Permalink)
You aren't any fun outside parties either.
[deleted] ยท -19 points ยท Posted at 17:56:26 on May 9, 2015 ยท (Permalink)
[removed]
[deleted] ยท 11 points ยท Posted at 18:21:06 on May 9, 2015 ยท (Permalink)
And this student is demonstrating that they understand that "equation" is any expression with an equals sign in it. It's definitely a good demonstration that they understand the concept. So well, in fact, that even within a context intended to obfuscate that fact, they still hold the true meaning in mind.
By your own criteria, this student did an outstanding job.
[deleted] ยท 9 points ยท Posted at 18:25:24 on May 9, 2015 ยท (Permalink)
[deleted]
[deleted] ยท -1 points ยท Posted at 18:28:30 on May 9, 2015 ยท (Permalink)
That's true of real life problems. But when the actual problem is not the stated problem, but "use this as a prompt to demonstrate that you have learned and/or acquired ability from your studies", that is no longer the case. And that is the purpose of a test, not solving some problem that has been solved millions of times before.
That's probably a good reason why academic success does not correlate to productive ability.
I hold that a student's duty is not to get as many points with as little work as possible, a student's duty is to learn and demonstrate learning.
Does this answer really not demonstrate learning? If anything, a student who is actually capable of this sort of out-of-the-box thinking - and knows enough to point out that x = 7 is an equation itself - is probably doing well in this class anyhow.
[deleted] ยท 32 points ยท Posted at 17:50:35 on May 9, 2015 ยท (Permalink)*
It's not a bullshit question, really, it shows the teacher is worried if students are actually understanding what an equation is, instead of simply following patterns to solve it.
He obviously didn't expect a student to pull a "technically correct", which is not to say he gave him a 0 for it, but it defeats the purpose.
Or not, I'm not sure if it shows the kid understand what an equation is or not.
Well, he wrote an equation, so i'm willing to bet he knows what one is.
[deleted] ยท 13 points ยท Posted at 18:12:30 on May 9, 2015 ยท (Permalink)
"He obviously didn't expect a student to pull a "technically correct"...". The question reads "... you can make the equation as simple or complex as you want". You should expect a student to answer your question within the parameters of which you ask.
c3534l ยท 2 points ยท Posted at 18:15:50 on May 9, 2015 ยท (Permalink)
I don't think you should be giving vague questions where even you can't predict what a correct answer might look like. If the teacher wanted to see if students understood what an equation was, they could have easily come up with a different question; arrange "x", "sqrt(49)", "y", "0" into an equation; or perhaps "Which of the following choices is an equation"; or even "In a sentence or two, explain the difference between a statement and an equation."
[deleted] ยท 7 points ยท Posted at 19:19:48 on May 9, 2015 ยท (Permalink)*
Actually it contains none of those so it is the absence of them. Combination indicates that 2 or more are present; although, it would be a dick move to slight a child for just using one of those.
Consider the subspace spanned by some vectors. Any vector in that subspace must be a linear combination of those vectors, but the zero vector must also exist. Therefore, absence of set members does not imply the object isn't a combination of the set members.
I guess I can be downvoted and you can have a sense of superiority, but combinations with absent terms exist throughout mathematics- and considering this is a thread about being technically correct...
Is true, since the "=" operator returns a pointer to its left hand parameter, which in this case is not Null. Any value != Null is treated as true in C++.
Not quite, an assignment expression returns the rvalue.
At any rate, it isn't an equation since a C++ compiler can't parse x + 1 = 7;
Kyyni ยท 2 points ยท Posted at 09:42:46 on May 10, 2015 ยท (Permalink)
No, the assignment operator, by default returns a reference to the assignee, that is, the left hand side of the assignment. Source. Basically it works the same way, though.
The assignment operator is right-associative, so a chained assignment like
a=b=c=3;
resolves to
a=(b=(c=3));
which functions like
c=3;
b=c;
a=b;
omegian ยท 1 points ยท Posted at 19:16:18 on May 11, 2015 ยท (Permalink)*
Sorry, lvalue, not rvalue. It isn't a pointer though.
za419 ยท 1 points ยท Posted at 22:33:36 on May 9, 2015 ยท (Permalink)
Only because x + 1 is recognized as an rvalue. + does take precedence over =, but since it's not an lvalue, you can't set 7 to the temporary copy.
nah, i think the simplest solution would be 0=0. A for effort though
isinned ยท 2 points ยท Posted at 09:04:33 on May 10, 2015 ยท (Permalink)
Depends how you define "simplest solution". x = 7 is the laziest solution because it was already given as an answer, which makes it simpler than thinking of another solution IMO.
The stuff at the beginning basically means n starts at 0 and continues to infinity. The equation after that zn / n! equals ez as n goes to infinity and the equations for each value of n are summed.
Z0 / 0! + z1 / 1! + z2 / 2! + ... + zn / n! = ez
Edited for formatting
Tywien ยท 8 points ยท Posted at 19:14:48 on May 9, 2015 ยท (Permalink)
i guess the problem is the formatting. In a properly formatted equation there woule be n = 0 below the sigma and the infinity symbol above it .. i too had to think what that should mean.
In case you don't know e: It is a constant value with some useful characteristics. For example, f(x)=ex is a function that has itself as derivation. But like pi, you can't write it down due to its infinite numbers after the point.
The definition above is a way to describe e. Set z = 1 and you get
n|0โโโ(1n /n!) = e1 = e
In words, you sum up all (1/n!) terms (with n = 0,1,2,3,...,โ) and get e:
I really love nitpicking so could you please give me the derivation of f(x)=0 and look for a very small mistake in your comment?
I would also like a downvote, so people won't have to read my silly and selfish comment.
Basically it works something like this: You can replace any function with a sum of other functions, assuming you choose the other functions in a very clever way and scale them accordingly. If you are ready to accept a tiny bit of imprecision, it's possible to choose functions that are easy to work with. Some guy figured out how to do that in an easy way, and now nobody gives a fuck on how to do the real math any more and just uses a taylor approximation, because it's more than good enough, but is blazingly fast on PCs.
The solution to any "how can we compute this function?" is usually always "and from here we can do a taylor approximation", or "we can't".
But I can't break it down on how that actually works. That's just a bunch of proofs.
In mathematics, a Taylor series is a representation of a function as an infinite sum of terms that are calculated from the values of the function's derivatives at a single point.
The concept of a Taylor series was discovered by the Scottish mathematician James Gregory and formally introduced by the English mathematician Brook Taylor in 1715. If the Taylor series is centered at zero, then that series is also called a Maclaurin series, named after the Scottish mathematician Colin Maclaurin, who made extensive use of this special case of Taylor series in the 18th century.
It is common practice to approximate a function by using a finite number of terms of its Taylor series. Taylor's theorem gives quantitative estimates on the error in this approximation. Any finite number of initial terms of the Taylor series of a function is called a Taylor polynomial. The Taylor series of a function is the limit of that function's Taylor polynomials, provided that the limit exists. A function may not be equal to its Taylor series, even if its Taylor series converges at every point. A function that is equal to its Taylor series in an open interval (or a disc in the complex plane) is known as an analytic function in that interval.
Imagei - As the degree of the Taylor polynomial rises, it approaches the correct function. This image shows sin(x) and its Taylor approximations, polynomials of degree 1, 3, 5, 7, 9, 11 and 13.
cleroth ยท 2 points ยท Posted at 01:34:19 on May 11, 2015 ยท (Permalink)
now nobody gives a fuck on how to do the real math any more and just uses a taylor approximation
Pretty sure the approximations are used because they're faster, not because we "can't do real math."
And for anyone interested, this is how a lot of CPUs do intrinsics for trigonometric functions. As you can imagine, you don't really need full accuracy for such stuff.
I see, thanks. I guess it's ok that there are things that I can't understand for now. Maybe in the future, when I'll be able to augment my brain, I'll understand these things easily.
From Wikipedia : In mathematics, anย equationย is an equality containing one or more variables. Solving theย equation consists of determining which values of the variables make the equality true.
[deleted] ยท 4 points ยท Posted at 01:53:52 on May 10, 2015 ยท (Permalink)
Dude, seriously. Equations and inequations are two opposites things . Saying one is a subset of the other is like saying north is a subset of south. Here is a bridge, now get over it.
Every requirement from non tech product owners. "I want a login button that is blue." Then "why doesn't it change colors when I click it? Where's then loading bar? There's no error message I'd I haven't entered anything or incorrect data. There's no field validation. It doesn't remember me when I came back."
My college algebra prof was more impressed with simpler examples.
If he wanted an equation a polynomial with 8 as a solution, he would probably put "Really?" if you gave an answer like
CTMGame ยท 16 points ยท Posted at 20:40:38 on May 9, 2015 ยท (Permalink)
But... but you forgot the =0 part. Also, x can be equal to -2, 2+3i, 8 or 10 here. 8 is not the unambigous solution.
za419 ยท 19 points ยท Posted at 22:24:40 on May 9, 2015 ยท (Permalink)
It doesn't say "8 as the only solution"... So, theoretically, "xโC" (where C denotes the set of all complex numbers), while really really vacuous, and probably even dumber than it is vacuous, is a satisfactory answer.
Case x = n + 1, with assumption that 0=0 in the x = n case. 0=0 still ok. The nice thing is that this step is usually complicated, but with an equation that doesn't actually contain x, it's completely trivial.
This shows that 0=0 for any integer value of x that is 0 or bigger, according to how induction works. I knew this technique would be useful at some point. Winning internet smart-ass points.
The proof for negative x or non-integer x is left as an exercise to the viewer.
[deleted] ยท 17 points ยท Posted at 23:20:39 on May 9, 2015 ยท (Permalink)
From a programming standpoint you are correct. But I am fairly certain that from a purely mathematical (sans programming) standpoint 0 is identical to 0 in every sense of the word. Seeing as math isn't strongly typed.
Xgamer4 ยท 1 points ยท Posted at 22:01:18 on May 10, 2015 ยท (Permalink)
You'd be surprised. Being an element of a set is effectively the same as being strongly typed.
Granted, most mathematicians gloss over it automatically because it's generally not important, and half the time it is important there's a relation between the sets that makes it not important (as is the case between 0 in C and 0 in R), but it's still there, and still important.
This is mostly speaking generally. Speaking specifically of 0, 0 is the general shorthand for the additive identity. If I let X and Y be additive groups, then there's a 0 in X and a 0 in Y (in that there's an additive identity in each), and we know that those elements behave similarly by virtue of both being additive identities, but you'd be remiss to say the 0s are the same thing.
In the case of R and C, it just so happens that the 0 in R and the 0 in C are functionally the same element (though not technically, as the 0 in C is technically 0+0i, as it needs to be an element of C) in that R is an additive subgroup of C and subgroups preserve the identity.
Well by that logic then 0 = 0 when x = 7 isn't always true, so the entire premise is flawed and we can't do the 0 + x != 0 + x thing to show that they are equal.
Either my shorter proof works or neither of them due because the statement isn't true to begin with.
Xgamer4 ยท 1 points ยท Posted at 22:47:40 on May 10, 2015 ยท (Permalink)
Well, in the context of the question we're working in R, and 0 in R is always equal to 0 in R.
I was just being a smart-ass by removing that context. There's no major problem anywhere.
That is not a valid number in mathematics. You might as well ask me what if x is a car. I have only proven it correct under the assumption that the laws of mathematics are true, which is not always the case on computer hardware. IEEE 754 is just an approximation to begin with.
cleroth ยท 1 points ยท Posted at 01:38:24 on May 11, 2015 ยท (Permalink)
I thought about this the last time it was posted: What kind of dick "really?"s the student providing the most efficient, most correct answer to the question.
If equation meant other equation, fucking say so instead of being snarky when you get a correct answer that isn't the one you were planning for.
amunak ยท 1 points ยท Posted at 13:28:01 on May 10, 2015 ยท (Permalink)
It's a dumb question. Even if they asked for different equation, you could still just use something like 0=0, y=y and such.
Tuhljin ยท 1 points ยท Posted at 03:11:09 on May 10, 2015 ยท (Permalink)
My friends and family say "Really?" to each other all the time and no one is offended. Poking a little fun like that is, well, all in good fun. As long as the teacher didn't mark it wrong, I don't see the problem.
Written feedback from a teacher to a student is totally the same as friends joking around.
Tuhljin ยท 2 points ยท Posted at 07:19:18 on May 10, 2015 ยท (Permalink)
What kind of teachers have you been cursed with all your life? Or perhaps more to the point, how thin must your skin be to get offended by something so harmless as this without even knowing anything else about this particular teacher?
[deleted] ยท -2 points ยท Posted at 08:21:13 on May 10, 2015 ยท (Permalink)
[deleted]
Tuhljin ยท 1 points ยท Posted at 08:57:12 on May 10, 2015 ยท (Permalink)
you're offended
a teacher got offended
I already pointed out how your previous interpretations and assumptions were bad, and now you want to add to the pile against you?
You countered my assumptions with assumptions and that's okay :)
Tuhljin ยท 2 points ยท Posted at 09:57:02 on May 10, 2015 ยท (Permalink)*
The fact is that you made a bad assumption about me and you made an assumption, bad or not (but certainly unfair enough), about the teacher. The only assumption I'm making is that you're just trolling now because you're stubborn and have nothing really relevant to add, and that assumption seems justified given what you just posted.
yeah, if you're talking cartesian geometry. if they're totally unrelated variables, then it's moot. replace x with $num_of_beers and y with $percent_chance_she_will_have_sex_with_me and that might make more sense
omegian ยท 2 points ยท Posted at 19:28:07 on May 11, 2015 ยท (Permalink)
No, let's not. You claim
y + 0 * x ?= n
is always true because you reduced the coefficient of x to zero. The potentisl solution space is the x-y plane, and the solution is independent of x, but not of y.
but you're looking at this functionally. if we were talking about solution sets, then yeah that's totally right. but we're talking about variables in which you can store values. like i said, if we hadn't defined the variables as x and y it would make more sense.
it's like saying that we're making a sandwich, so we define variables for number of slices of cheese and number of slices of ham. now, hamSlices is completely independent of cheeseSlices unless and until we choose to graph them or create a mathematical function using them. we can make cheeseSlices equal 7 and then we can set hamSlices to literally anything we want and cheeseSlices will still be 7.
omegian ยท 2 points ยท Posted at 15:25:28 on May 12, 2015 ยท (Permalink)*
How do you know when an equation is true? By evaluating both sides and comparing the values. If there are variables in one side of the equation, you have plug in values before you can evaluate it.
Yes, if you introduce a second variable with a zero coefficient, then the solution is independent of it.
x + 0 * y ?= 7
Is true when x is 7 and "whatever" for y. That's not what /u/Wodashit proposed as the solution though, it was
y ?= n
For the solution which, I said way the hell back when, the truth of that statement is indeterminate because the value of y is undefined, and unconstrained, so it could be true or false. Whether x is 7 or not.
If he meant to say: "x = 7" is a solution, and it is completely independent of the value of y! Well, no kidding. It is the preexisting solution that's already written down, and why the teacher wrote "Really?".
Yes, I understand the concept of independent variables / orthogonal axes and the set of possible solutions, its the basis for calling the proposed solution incorrect.
Let me make this much simpler and remove the second variable.
if you do not express x in there the expression is true for any x, especially if x=7
old: f(x) = x
new: f(x) = 3
f(7) ?= 7
false
You would have to write 3 = 3, not introduce an undefined variable and compare it to a constant.
If the variables are truly independent, then knowing how many slices of ham are on the sandwich (or not) tells you nothing about how many slices of cheese are on the sandwich. Can you truly answer this question?
"There are seven slices of ham on the sandwich. Are there three slices of cheese on the sandwich?"
If not, you will understand why a system of equations with two unknowns in insoluble without a second equation.
y = 2x, y ?= 14
This is true when x = 7. The value of y is no longer unresolved.
[deleted] ยท 19 points ยท Posted at 15:59:57 on May 9, 2015 ยท (Permalink)
JViz ยท 3 points ยท Posted at 21:53:04 on May 9, 2015 ยท (Permalink)
The question can be interpreted as fiat. The flexibility given means that the answer is stating itself as true as long as the one condition is met, which it was.
[deleted] ยท 1 points ยท Posted at 19:24:28 on May 11, 2015 ยท (Permalink)
This is what I would do... make something so complicated that the teacher would spend hours trying to check if it is correct.
robhol ยท 6 points ยท Posted at 21:46:53 on May 9, 2015 ยท (Permalink)
Even better, x=x - it doesn't say "true if-and-only-if x is 7"
amunak ยท 5 points ยท Posted at 13:28:45 on May 10, 2015 ยท (Permalink)
Or just y=y or 0=0. Who needs x.
dokks ยท 3 points ยท Posted at 19:51:54 on May 9, 2015 ยท (Permalink)
Really hope she gave him credit for that.
s3vv4 ยท 3 points ยท Posted at 20:31:08 on May 9, 2015 ยท (Permalink)
0=0
rubyton ยท 1 points ยท Posted at 04:15:03 on May 11, 2015 ยท (Permalink)
kesuaus ยท 3 points ยท Posted at 14:28:11 on July 22, 2015 ยท (Permalink)
My teacher would let me fail the whole class if I wrote a shit like this. Because he would take it personally as in "you want to fuck with me boy? I'll show you how I can fuck with you"
[deleted] ยท 5 points ยท Posted at 04:34:27 on May 10, 2015 ยท (Permalink)
Definitely not an enterprise Java programmer though
[deleted] ยท 6 points ยท Posted at 21:44:03 on May 9, 2015 ยท (Permalink)
Nah, looks bad for me, too. The overline isn't really over the 9, it's more off to the right a little.
jP_wanN ยท 13 points ยท Posted at 16:43:47 on May 9, 2015 ยท (Permalink)
Okay... Anyway, I now know how to oฬ vฬ eฬ rฬ lฬ iฬ nฬ eฬ ฬ tฬ hฬ iฬ nฬ gฬ sฬ ฬ wฬ iฬ tฬ hฬ oฬ uฬ tฬ ฬ Hฬ Tฬ Mฬ Lฬ !
Because reddit doesn't let me use <span style="text-decoration: overline"> :(
ADdV ยท 5 points ยท Posted at 18:41:59 on May 9, 2015 ยท (Permalink)
Well... how??
jP_wanN ยท 2 points ยท Posted at 19:43:43 on May 9, 2015 ยท (Permalink)*
Just ask your favorite search engineโข how to insert unicode characters. In Gtk+ (which both Firefox and Chromium / Google Chrome use) it's Ctrl+Shift+U, then type the character number in hexadecimal.
The "combining overline" is unicode character #773 for whatever reason, which is 305 in hexadecimal (you'll probably find it as 0x0305 but that's just a different notation for the same number); there's also the "combining double macron" character, which is identified by the number 35e and just looks like a wider version of the overline character.
Oh, and you place combining characters after the character you want them to apply to, not before like with accent keys you press before the letter you want them to be on.
EDIT: Oh, I forgot this is /r/ProgrammerHumor. I guess whoever reads this already know what Hex is then. Gonna leave the noob explanation anyway, maybe it helps someone :)
ADdV ยท 1 points ยท Posted at 20:21:46 on May 9, 2015 ยท (Permalink)
I am, much like the post-title, a 'future programmer' so the noob explanation is very much appreciated ^
minno ยท 14 points ยท Posted at 17:00:07 on May 9, 2015 ยท (Permalink)
Floating point numbers are not real numbers.
cparen ยท 7 points ยท Posted at 17:15:58 on May 9, 2015 ยท (Permalink)
Actually, they're (nearly) all real numbers. In fact, they're rational numbers.
I think you mean to say that floating point arithmetic is not real arithmetic. It's an appropriation of real arithmetic, using a subset of rationals with power of two denominators.
echeese ยท -5 points ยท Posted at 17:16:40 on May 9, 2015 ยท (Permalink)
Actually, floating point numbers are more like real numbers than integers
khoyo ยท 2 points ยท Posted at 19:00:32 on May 9, 2015 ยท (Permalink)
They are actually a subset of rationals. Like rationals and integers, they are countable.
Real number aren't. The set of real number is very different from rationals, whereas rational looks a lot like integers.
iopq ยท 1 points ยท Posted at 05:57:07 on May 10, 2015 ยท (Permalink)
rationals are all real, so what he said isn't false
khoyo ยท 1 points ยท Posted at 10:01:08 on May 10, 2015 ยท (Permalink)
Integers are real too.
iopq ยท 2 points ยท Posted at 12:02:14 on May 10, 2015 ยท (Permalink)
Oh how I wish I had this question in one of my math tests. I would ask the teacher did he not realize how stupid the question was and list a few possible answers.
Tuhljin ยท -2 points ยท Posted at 03:12:57 on May 10, 2015 ยท (Permalink)
Of the two of you, the one acting the most stupid there (among other things) would be the one that called his teacher stupid.
So you are saying this is a valid question on a test? You do realize everyone here is making fun of this? Thanks for the downvote anyway.
Tuhljin ยท -1 points ยท Posted at 03:18:26 on May 10, 2015 ยท (Permalink)
Actually, I might not have downvoted you, but now you've earned it, hypocrite.
So you are saying this is a valid question on a test? You do realize everyone here is making fun of this?
Oh, and FYI, that's got to be one of the most ridiculous stretches of "logic" I've ever seen. I never made or hinted at any such argument. But I guess you were desperate to make this about me instead of dealing with how stupid it is to insult your teacher. If I need to, I can appeal to popularity also and point out the fact that most people would consider that incredibly foolish.
kirakun ยท -4 points ยท Posted at 21:32:19 on May 9, 2015 ยท (Permalink)
Let's get interesting. What is the most complex equation you can write that is consistent with x = 7?
SilasX ยท 1014 points ยท Posted at 15:24:53 on May 9, 2015 ยท (Permalink)
They said "as simple as you want".
tskaiser ยท 172 points ยท Posted at 15:49:06 on May 9, 2015 ยท (Permalink)
sillypantstoan ยท 192 points ยท Posted at 15:55:12 on May 9, 2015 ยท (Permalink)
Not an equation. You want something like 0=0.
tskaiser ยท 64 points ยท Posted at 16:02:40 on May 9, 2015 ยท (Permalink)
Logical equations are also equations.
sillypantstoan ยท 89 points ยท Posted at 16:07:53 on May 9, 2015 ยท (Permalink)
Logical equations still need two logical expressions with an equal sign, like p=p and 1.
tskaiser ยท 71 points ยท Posted at 16:09:45 on May 9, 2015 ยท (Permalink)
Hm. I concede.
x = xthen.[deleted] ยท 11 points ยท Posted at 12:21:48 on May 10, 2015 ยท (Permalink)
[deleted]
Kurbits ยท 6 points ยท Posted at 12:57:20 on May 10, 2015 ยท (Permalink)
What about contradictions?
โฅ
qezi2 ยท 2 points ยท Posted at 04:32:47 on August 20, 2015 ยท (Permalink)
This is true for
x = 7but not forx = NaNtskaiser ยท 3 points ยท Posted at 09:46:37 on August 20, 2015 ยท (Permalink)
Hm. Yes.
x = x where x โ X and X is a totally ordered set. This precludes IEEE 754 which is totally ordered except forNaN,-0, and0.Also, what are you doing in a 3 month old thread? :)
outadoc ยท -9 points ยท Posted at 16:59:01 on May 9, 2015 ยท (Permalink)
tskaiser ยท 14 points ยท Posted at 17:05:19 on May 9, 2015 ยท (Permalink)
Recursion
iSmokeGauloises ยท 11 points ยท Posted at 17:17:03 on May 9, 2015 ยท (Permalink)
Recursion
luminadevis ยท 1 points ยท Posted at 20:28:42 on May 9, 2015 ยท (Permalink)
Recursed
[deleted] ยท 2 points ยท Posted at 23:12:04 on May 9, 2015 ยท (Permalink)
Recursion
skulgnome ยท 5 points ยท Posted at 17:43:15 on May 9, 2015 ยท (Permalink)
A logical expression by itself equates to true.
markamurnane ยท 27 points ยท Posted at 18:01:47 on May 9, 2015 ยท (Permalink)
False.
skulgnome ยท 3 points ยท Posted at 18:15:04 on May 9, 2015 ยท (Permalink)
Here, FTFY
markamurnane ยท 10 points ยท Posted at 18:26:00 on May 9, 2015 ยท (Permalink)
No, I mean literally. False != True.
skulgnome ยท 2 points ยท Posted at 21:09:08 on May 9, 2015 ยท (Permalink)*
Likewise: it's written like ยฌP. It's a pune, or play on words.
landonrobinson ยท 1 points ยท Posted at 23:30:01 on May 9, 2015 ยท (Permalink)
Right, but False != True is True, also known as !False.
markamurnane ยท 1 points ยท Posted at 04:06:38 on May 11, 2015 ยท (Permalink)
Your original statement was that a logical expression by itself equates to true. My example, False, is a logical expression that does not equate to True, i.e. False != True. The expression False != True is True, that is why I said it.
landonrobinson ยท 2 points ยท Posted at 04:45:31 on May 11, 2015 ยท (Permalink)
I was just making a joke, not refuting anything.
markamurnane ยท 1 points ยท Posted at 05:15:12 on May 12, 2015 ยท (Permalink)
Oh, sorry.
Chemical_Scum ยท 8 points ยท Posted at 22:06:54 on May 9, 2015 ยท (Permalink)
DutchMuffin ยท -1 points ยท Posted at 01:38:24 on May 10, 2015 ยท (Permalink)
How would 7x + 2 evaluate to a Boolean value.
sillypantstoan ยท 8 points ยท Posted at 01:50:38 on May 10, 2015 ยท (Permalink)
That's not a logical expression.
IrateGod ยท 5 points ยท Posted at 03:10:50 on May 10, 2015 ยท (Permalink)
Just convert! Yes, I do JavaScript...
sillypantstoan ยท 1 points ยท Posted at 19:23:31 on May 9, 2015 ยท (Permalink)
P and ~P evaluates to false.
skulgnome ยท 1 points ยท Posted at 21:10:40 on May 9, 2015 ยท (Permalink)
But this is about equations, not evaluation. Just PโงยฌP is a contradiction, aka "literal false".
sillypantstoan ยท 2 points ยท Posted at 01:49:02 on May 10, 2015 ยท (Permalink)
That's the point I was making.
So I gave a counterexample.
[deleted] ยท 2 points ยท Posted at 18:45:19 on May 9, 2015 ยท (Permalink)*
ฮฆ
MolokoPlusPlus ยท 0 points ยท Posted at 16:58:58 on May 9, 2015 ยท (Permalink)
I interpreted "when" as "iff".
bigpigfoot ยท 10 points ยท Posted at 01:55:01 on May 10, 2015 ยท (Permalink)
exactly.. the problem was with the problem statement, not the answer!
X-Craft ยท 514 points ยท Posted at 15:34:05 on May 9, 2015 ยท (Permalink)
Legit solution
[deleted] ยท 75 points ยท Posted at 23:18:50 on May 9, 2015 ยท (Permalink)
[deleted]
IIdsandsII ยท 29 points ยท Posted at 23:45:24 on May 9, 2015 ยท (Permalink)
My ex is undeclared
videoflyguy ยท 2 points ยท Posted at 02:31:13 on May 10, 2015 ยท (Permalink)
Lucky, my ex just fucks more guys than I can count
Vakieh ยท 7 points ยท Posted at 01:14:09 on May 10, 2015 ยท (Permalink)
Zantier ยท 1 points ยท Posted at 11:06:29 on May 10, 2015 ยท (Permalink)
It's OK, this is written in MathML.
The (strong) type is inferred and what looks like reassignment is actually a redundant declaration-part of an immutable declaration.
lw9k ยท 1 points ยท Posted at 12:21:09 on May 10, 2015 ยท (Permalink)
Uhh, we have this thing called type inference, Java peasant!
Shadowing.
Well... should have used a pure language! (Seriously though, they should have worded that question better, what did they expect?)
Kaneshadow ยท 41 points ยท Posted at 00:04:09 on May 10, 2015 ยท (Permalink)
This is a total "pieces of flair" situation and I am not happy with its presence in a math class.
GMJack ยท 777 points ยท Posted at 16:33:10 on May 9, 2015 ยท (Permalink)
markyland ยท 82 points ยท Posted at 19:10:28 on May 9, 2015 ยท (Permalink)
If x is NaN this returns false :)
Sapiogram ยท 155 points ยท Posted at 19:34:59 on May 9, 2015 ยท (Permalink)
Thank god math we don't write math in Javascript.
OmnipotentEntity ยท 46 points ยท Posted at 20:09:27 on May 9, 2015 ยท (Permalink)
JavaScript isn't the only programming language that has to deal with IEEE float NaNs
Mujapro ยท 16 points ยท Posted at 21:46:22 on May 9, 2015 ยท (Permalink)
I also initially thought this is a JavaScript bug / weird behaviour, but thank to your comment I actually looked it up and tested. In Java/Scala, Go and C (and probably all other languages) this holds true:
(NaN == NaN) == falsebacondev ยท 11 points ยท Posted at 01:13:08 on May 10, 2015 ยท (Permalink)*
Yup. If something that yields a value that that is not a number, it doesn't necessarily mean that it is equivalent to a similar expression. The problem isn't that
NaN == NaNdoesn't evaluate totrue. The problem is that the comparison doesn't yield an indeterminate value. It's possible that the two expressions could be equal. It's possible that they are not. There's no way of knowing with the given information. The lack of three-valued logic in most programming languages upsets me.winsuck ยท 4 points ยท Posted at 01:18:35 on May 10, 2015 ยท (Permalink)
Three-valued logic?
bacondev ยท 19 points ยท Posted at 01:25:05 on May 10, 2015 ยท (Permalink)
Until I can do something like
I will not be content.
purplestOfPlatypuses ยท 2 points ยท Posted at 03:00:26 on May 10, 2015 ยท (Permalink)
I mean, realistically if else handles the idk. The else is literally saying whether it's false or not, as long as it isn't true to any of the prior ifs, do this. Booleans just need a "?" possibility.
bacondev ยท 4 points ยท Posted at 03:21:13 on May 10, 2015 ยท (Permalink)*
I see what you're saying. One could check for values that yield indeterminate values in an expression. But that could get messy or at least confusing. Most programmers think with two-valued logic. If an expression isn't true, they'd assume it's false. So throwing the indeterminate case into the else statement, though technically correct, could introduce some bugs. The issue you brought up could be fixed by putting the idk case before the else statement.
But what if you want the same thing to happen for the idk and else structures? Make a new function for even the most trivial of blocks? It'd be nice to have a way to combine the two. So perhaps a switch statement with a new keyword would be ideal for three-valued (or even n-valued) logic.
The problem here is that the switch expression is compared for equality (i.e.
some_expression == trueorsome_expression == unknownorsome_expression == false). The second would be indeterminate in itself. It's an interesting issue. I suppose a construct could be added for determining determinateness (e.g.isUnknown(some_expression)). But I'm sure there is a more elegant solution than the ones I have presented.It would be a rarely used feature, but one of those nice to have features when in fact needed.
purplestOfPlatypuses ยท 2 points ยท Posted at 03:51:28 on May 10, 2015 ยท (Permalink)
Eh, it wouldn't really matter much except for syntax parsing. In the end, it would probably not be used to much regardless because there's not terribly many cases where you're working with a nondeterministic if condition in practical use as you said.
For that, I would just have the interpreter/compiler assume you want the block to function as a normal "if/else" as they work now (if true, else false or unknown). I don't necessarily think some_expression == unknown is indeterminate if boolean allows for an unknown value.
But if you want to see something like that supported, one of the best ways is to make your own language (or change an existing language to support it). Sillier languages have been created for worse reasons, I guarantee it.
bacondev ยท 2 points ยท Posted at 04:26:19 on May 10, 2015 ยท (Permalink)
I'm taking a formal languages class and an operating systems class next semester and then a programming languages class the following semester. :)
Well, the
unknownkeyword would represent some unknown value, not a particular unknown value (think in terms of the integer equivalents oftrueandfalse). I think comparing tounknownshould always be indeterminate. For example, what if you try comparing an integer to the integer representation ofunknown?purplestOfPlatypuses ยท 1 points ยท Posted at 04:44:09 on May 10, 2015 ยท (Permalink)
What's the integer representation of true? The only reason it's "anything but 0" in many languages is because it's easy and fits the desired functionality. Why is 0 any less truthy than 2, or "" less truthy than "a"? There's convenience arguments but that's about it. Testing against "true" isn't against a specific true value, just the boolean idea of true and with trinary booleans (true, false, unknown) you're just checking against the boolean idea of unknown.
However, I counter your last example with, "why are you turning booleans into integers in the first place?" That sounds like some hacky shit right there.
bacondev ยท 1 points ยท Posted at 05:06:34 on May 10, 2015 ยท (Permalink)*
As far as the truth of an integer goes, I think the integer representations originate from physics. If an object is at rest, its velocity is zero. The question is, "Is the object in motion?" The answer there unto is the answer to the question, "Does it have a nonzero velocity?" So zero is false and anything else is true. This applies to pretty much any physical quantity (e.g. voltage, current, energy, etc.). I agree that this is a semantic issue though. The question asked could just as easily be, "Is the object at rest?" For example, I know off hand that sh (and its derivatives) use 0 to represent truth and anything else to represent non-truth. It just asks the negation of what would typically be asked (in the interest of quantifying false values).
In either case, an indeterminate state of motion or rest would mean that you don't know if the velocity is 0, 1, -5, etc. (omitting units). It doesn't really matter how the question of its velocity is phrased because it cannot be certainly answered with boolean logic.
It has to be stored in memory somehow. But I think it's more critical to think of how to translate integers to boolean values (or some other logic system). The only value(s) that would generate an indeterminate state in ternary logic is simply not knowing what value you're working with.
I don't think it necessarily is less valid. I think that a system for deciding the validity of strings was created for convenience just as systems for deciding the validity of integers was created.
I actually don't even think that values should have inherent validity. How can the value be true if there is no question being asked? It's not an answer if it's not a response to a question. The question would be, "If some_expression?" That just doesn't make sense. If some expression what? Sure, if
some_expressionis a boolean value, there doesn't really need to be question since you already have the answer. But that shouldn't apply to other types. While many would roll their eyes at this, I would like a language that forces a question to be asked (i.e. a comparison operation). At the risk of contradicting myself, back to the memory remark I made, the processor can store the boolean value in memory however the processor sees fit, but it should be invalid to interpret that as another type just as it is to interpret an integer as a set.Ari_Rahikkala ยท 2 points ยท Posted at 03:16:46 on May 10, 2015 ยท (Permalink)
For what it's worth, even in SQL which is one of the few languages that do have three-valued logic, null is falsy (except in CHECK constraints). I can't see any reason why you couldn't have a three-branched IF, with a true, false, and a null branch, though.
alexanderpas ยท 10 points ยท Posted at 01:51:26 on May 10, 2015 ยท (Permalink)
That's because 0/0 does not equal sqrt(-1).
Kmouse2 ยท 1 points ยท Posted at 05:07:29 on May 10, 2015 ยท (Permalink)
You sure?
Sinity ยท 1 points ยท Posted at 14:04:48 on May 10, 2015 ยท (Permalink)
Wait... NaN == NaN evaluates to false?
Hamburgex ยท 13 points ยท Posted at 21:29:06 on May 9, 2015 ยท (Permalink)*
Just imagine... Just for a single second, that instead of mathematics we did engineering, science and logic all through JavaScript. Just... let that sink in.
path411 ยท 9 points ยท Posted at 22:13:02 on May 9, 2015 ยท (Permalink)
jQuery.emc2()
Hamburgex ยท 2 points ยท Posted at 08:33:08 on May 10, 2015 ยท (Permalink)
Gives you the energy of a particle with a precission of Eยฑ10 joules. That'll be enough for sure, right?
they_have_bagels ยท 3 points ยท Posted at 22:28:28 on May 9, 2015 ยท (Permalink)
Sounds great! Where do I sign up?
thirdegree ยท 13 points ยท Posted at 23:02:17 on May 9, 2015 ยท (Permalink)
/r/Hell
BasedSkarm ยท 6 points ยท Posted at 00:10:53 on May 10, 2015 ยท (Permalink)
What! Hell is private? I thought the devil would take me with open arms while saying "ah, yes, I've been waiting for you"...
Kyyni ยท 2 points ยท Posted at 09:21:46 on May 10, 2015 ยท (Permalink)
(In a Satanic voice) You've been a good boy, a very good boy, /u/BasedSkarm...
BasedSkarm ยท 2 points ยท Posted at 13:00:37 on May 10, 2015 ยท (Permalink)
See what I mean? This is violating my rights as an American! * I demand entry into hell*
jaavaaguru ยท 3 points ยท Posted at 12:06:43 on May 11, 2015 ยท (Permalink)
Does being an American affect the amount of rights you are entitled to?
BasedSkarm ยท 1 points ยท Posted at 17:31:08 on May 11, 2015 ยท (Permalink)
Perhaps not, but it certainly affects my perception of the amount of rights i'm entitled to.
BasedSkarm ยท 6 points ยท Posted at 00:11:11 on May 10, 2015 ยท (Permalink)
nodejs
they_have_bagels ยท 2 points ยท Posted at 00:12:34 on May 10, 2015 ยท (Permalink)
I was being tongue in cheek. I think it would be fun to learn real mathematics and engineering in JavaScript. ;-)
BasedSkarm ยท 5 points ยท Posted at 00:22:27 on May 10, 2015 ยท (Permalink)
I know, I just like spreading nodejs everywhere i possibly can. Almost as much as i try to spread Negima.
autowikibot ยท 2 points ยท Posted at 00:23:24 on May 10, 2015 ยท (Permalink)
Negima! Magister Negi Magi:
Interesting: List of Negima! Magister Negi Magi characters | List of Negima! Magister Negi Magi chapters | Negima!? | Kodansha Comics USA
Parent commenter can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words
they_have_bagels ยท 2 points ยท Posted at 01:11:09 on May 10, 2015 ยท (Permalink)
I read the first 20 something volumes, but lost interest, unfortunately. :-(
BasedSkarm ยท 2 points ยท Posted at 13:03:33 on May 10, 2015 ยท (Permalink)
Not gonna write a whole negima review, but have you got to the magic world arc yet? Worth reading even if you have lost interest in the series
they_have_bagels ยท 1 points ยท Posted at 15:49:42 on May 10, 2015 ยท (Permalink)
Don't think I did. I will have to reread it and see. I did like the story, but grew impatient waiting for it to come out -- I like binge reading a lot more. Maybe I will check it out again.
BasedSkarm ยท 1 points ยท Posted at 22:45:05 on May 10, 2015 ยท (Permalink)
well its done now =P
vedun23 ยท 2 points ยท Posted at 23:56:31 on May 9, 2015 ยท (Permalink)
Sorry, I'm going to go cry whilst puking now.
Mujapro ยท 23 points ยท Posted at 21:47:36 on May 9, 2015 ยท (Permalink)
Which literally can't be because x is already 7.
markyland ยท 2 points ยท Posted at 02:52:08 on May 10, 2015 ยท (Permalink)
Good point sir. You are completely right.
Pinguinsan ยท 1 points ยท Posted at 20:01:15 on May 9, 2015 ยท (Permalink)
In what language?
CTMGame ยท 18 points ยท Posted at 20:30:57 on May 9, 2015 ยท (Permalink)
Techically all languages that correctly implement IEEE754 floating point arithmatic.
markyland ยท 3 points ยท Posted at 21:38:25 on May 9, 2015 ยท (Permalink)
A few. Java for one. That's actually the definition of NaN and what you find in the isNaN() check.
charredgrass ยท 346 points ยท Posted at 17:02:01 on May 9, 2015 ยท (Permalink)
Alternatively...
FoeHammer99099 ยท 353 points ยท Posted at 17:16:26 on May 9, 2015 ยท (Permalink)
Strictly speaking, that's an expression but not an equation.
fb39ca4 ยท 59 points ยท Posted at 19:50:22 on May 9, 2015 ยท (Permalink)*
Most
orgasprogramming languages only have expressions, not equations. The == operator simply gives you an expression that evaluates to true when the operands are equal, and false otherwise.Mustachioed_Maverick ยท 104 points ยท Posted at 19:54:52 on May 9, 2015 ยท (Permalink)
I wish I could work with this orgasaming language.
Cyph0n ยท 19 points ยท Posted at 20:06:27 on May 9, 2015 ยท (Permalink)
Oh yeah... is what I say when I compile and run my OrgASM code.
jrchin ยท 27 points ยท Posted at 19:55:36 on May 9, 2015 ยท (Permalink)
Orgasming languages :)
FoeHammer99099 ยท 9 points ยท Posted at 19:54:54 on May 9, 2015 ยท (Permalink)
They're not mutually exclusive. All equations are expressions.
lennyp4 ยท 13 points ยท Posted at 21:23:47 on May 9, 2015 ยท (Permalink)
Equation:
Expression:
bacondev ยท 4 points ยท Posted at 01:07:59 on May 10, 2015 ยท (Permalink)
What about
a++?lennyp4 ยท 6 points ยท Posted at 01:36:25 on May 10, 2015 ยท (Permalink)
Post increment is syntax sugar for
You can use it as an arg:
Which returns a, and adds a command afterward to increment a 1:
Likewise, you have pre increment. It increment, then returns:
++a;
bacondev ยท 1 points ยท Posted at 01:41:54 on May 10, 2015 ยท (Permalink)
Thanks. I didn't know what
a++doesโฆI was asking if it's considered an expression or a statement.
lennyp4 ยท 6 points ยท Posted at 02:26:05 on May 10, 2015 ยท (Permalink)
Both, it returns a (expression), then equates it to a + 1 (equation)
Xenophyophore ยท 1 points ยท Posted at 05:06:14 on May 10, 2015 ยท (Permalink)
An equation is more like a constraint, or an assertion.
x = 7holds for anyxthat is equal to7.x = yholds for anyxthat is equal toy.x * x = x + xholds for anyxthat, when multiplied by itself, is equal to itself plus itself.==is like an equation, except instead of being possible or impossible, it returns true or false.bacondev ยท 1 points ยท Posted at 01:09:27 on May 10, 2015 ยท (Permalink)
In most programming languages,
=replaces the:=operation in mathematics and==replaces the=operator in mathematics.nermid ยท -1 points ยท Posted at 23:14:54 on May 9, 2015 ยท (Permalink)
What? Most languages do variable assignment through the use of equations.
x=5is an equation, as isx = y+6.fuzzyfuzz ยท -6 points ยท Posted at 20:25:10 on May 9, 2015 ยท (Permalink)
You're obviously not an actual programmer if your phone is auto correcting programming to orgasming.
ZetaHunter ยท 7 points ยท Posted at 20:47:00 on May 9, 2015 ยท (Permalink)
Programming is like orgasming, cmon, didn't you know? You probably don't code so hard at all!
Miles-za ยท 4 points ยท Posted at 22:29:17 on May 9, 2015 ยท (Permalink)
It's always hard when I code.
nermid ยท 3 points ยท Posted at 23:15:59 on May 9, 2015 ยท (Permalink)
Like sex, programming involves loads of meticulous preparation and study, followed by a few minutes of flailing around like a dying fish, finding out it didn't work at all, and then being disappointed in yourself.
Miles-za ยท 1 points ยท Posted at 01:55:03 on May 10, 2015 ยท (Permalink)
My personal experience tend to differ a bit from yours, but have an upvote for this beautiful comparaison.
nermid ยท 2 points ยท Posted at 02:17:33 on May 10, 2015 ยท (Permalink)
It's not a perfect analogy, of course.
I'm getting better at programming.
LarsP ยท 3 points ยท Posted at 07:22:31 on May 10, 2015 ยท (Permalink)
Even casually speaking, that is not an equation.
Aydoooo ยท -6 points ยท Posted at 19:12:50 on May 9, 2015 ยท (Permalink)
x = x; isn't an equation either.
GMJack ยท 19 points ยท Posted at 19:20:44 on May 9, 2015 ยท (Permalink)
by definition I believe it is:
Correct me if I'm wrong though I'm fully wiling to accept that it isn't an equation. It can be considered the simplified form of:
if it so wished.
dingari ยท 12 points ยท Posted at 19:38:16 on May 9, 2015 ยท (Permalink)
The semicolon gives away that it's an assignment, but not an equation.
GMJack ยท 6 points ยท Posted at 19:56:23 on May 9, 2015 ยท (Permalink)
0_0 I did that out of habit lol guess not.
Aydoooo ยท 15 points ยท Posted at 19:25:15 on May 9, 2015 ยท (Permalink)
I'm assuming (we are on /r/ProgrammingHumor) he meant "x = x;" as a piece of code just like you'd write in programming languages such as C or C++ etc. In that case, "x = x;" is an assignment, not an equation.
repsilat ยท 1 points ยท Posted at 23:09:58 on May 9, 2015 ยท (Permalink)
It's a little more general than (1), I think -- a lot of people would call inequalities "equations" as well.
Hamburgex ยท 1 points ยท Posted at 21:27:40 on May 9, 2015 ยท (Permalink)
It's an identity which could be classified as an equation that holds true for any number.
2Punx2Furious ยท -9 points ยท Posted at 17:43:14 on May 9, 2015 ยท (Permalink)
I wonder if it's processed any differently by the CPU.
FoeHammer99099 ยท 11 points ยท Posted at 18:10:49 on May 9, 2015 ยท (Permalink)
Probably. x==x is really just syntactic sugar for some equality call. I suppose if your compiler/interpreter is paying attention might just change it to "true", but that's the kind of scenario where weird bugs that no-one understands start popping up.
5225225 ยท 2 points ยท Posted at 18:39:20 on May 9, 2015 ยท (Permalink)
With -O1 and above, clang treats it the same as if it was
if (1). It's only with -O0 when it does a comparison.serendib ยท 5 points ยท Posted at 18:40:54 on May 9, 2015 ยท (Permalink)
Most compilers will do two things when they see something like if (x==x):
They will give you a warning that your conditional is always true, since there's no point to have a conditional if it will always be one of true or false.
It will optimize away the call like you said to simply be true so that it will never actually have to evaluate the comparison when it runs
Krissam ยท 3 points ยท Posted at 18:59:03 on May 9, 2015 ยท (Permalink)
Yes and no.
it would be, but any smart compiler will see the condition will always evaluate to true and just skip it.
Spartan1997 ยท 20 points ยท Posted at 19:14:15 on May 9, 2015 ยท (Permalink)
Alternatively, 7=7
fb39ca4 ยท 25 points ยท Posted at 19:51:39 on May 9, 2015 ยท (Permalink)
sin2 (y) + cos2 (y) = 1
fuzzyfuzz ยท 2 points ยท Posted at 20:25:55 on May 9, 2015 ยท (Permalink)
y = 3
xbtdev ยท 9 points ยท Posted at 23:56:43 on May 9, 2015 ยท (Permalink)
Also:
[deleted] ยท 3 points ยท Posted at 00:21:54 on May 10, 2015 ยท (Permalink)
1 = 1
raaneholmg ยท 2 points ยท Posted at 09:37:28 on May 10, 2015 ยท (Permalink)
1+1=2
[deleted] ยท -3 points ยท Posted at 21:21:25 on May 9, 2015 ยท (Permalink)
[deleted]
Sarke1 ยท 3 points ยท Posted at 23:57:24 on May 9, 2015 ยท (Permalink)
x = 14
No points for you.
supercordial_aliens ยท 0 points ยท Posted at 03:31:50 on May 10, 2015 ยท (Permalink)
In C, this is false if x is 0.
[deleted] ยท -6 points ยท Posted at 19:10:12 on May 9, 2015 ยท (Permalink)
[deleted]
Zephyron51 ยท 17 points ยท Posted at 19:16:11 on May 9, 2015 ยท (Permalink)
FTFY
iTotzke ยท 2 points ยท Posted at 20:01:04 on May 9, 2015 ยท (Permalink)
Technically, in some languages if do an an assignment in the if_conditional (hence the rationale of yoda conditions), it will evaluate to be true, and when you reach
The value of x will be 7.
za72 ยท 1 points ยท Posted at 20:13:26 on May 9, 2015 ยท (Permalink)
Wtf!? What's the logic in that?
digitalnexus ยท 2 points ยท Posted at 20:34:04 on May 9, 2015 ยท (Permalink)
If I'm not mistaken, this mostly happens in C-style languages where anything that isn't strictly false (0/null) is evaluated as a true in if statements. (This allows for fast comparisons using the processor's zero flag)
Since assignment returns the value of the assignment (allowing a = b = 7 to work properly) it evaluates to non-false and goes through.
za72 ยท 1 points ยท Posted at 20:49:28 on May 9, 2015 ยท (Permalink)
So the if statement is used to assign value to a variable and return a true condition, is this used for if else conditions? I'm not seeing any other use if we never end up testing or using the value of x...
digitalnexus ยท 2 points ยท Posted at 20:55:13 on May 9, 2015 ยท (Permalink)
It's not necessarily meant as an actual feature--it's just a rather interesting interaction between two separate language features that ends up working together in that way. I'm sure there's some strange situations where it would be useful for actual code, but I can't quite think of any right now.
Mostly it just ends up being a problem for beginning C programmers that come from languages that use a single '=' as the comparison operator.
qm11 ยท 3 points ยท Posted at 21:51:54 on May 9, 2015 ยท (Permalink)
I've used it in the following general structure:
The loop runs until foo() returns 0. You could also do code like:
This loop would run until foo() returns something other than 0. It's generally useful when you want to assign a function's return value to a variable, and check the value of that variable at the same time. Whether it's good style or not is up for debate.
Relevant stack overflow:
http://stackoverflow.com/questions/151850/why-would-you-use-an-assignment-in-a-condition
http://stackoverflow.com/questions/17681535/variable-assignment-in-if-condition
Rhodoferax ยท 114 points ยท Posted at 18:09:51 on May 9, 2015 ยท (Permalink)
-- John W Backus, creator of Fortran, the first full compiled language.
omegian ยท 35 points ยท Posted at 21:31:00 on May 9, 2015 ยท (Permalink)*
Writing a program clever enough to allow others to be lazy isn't really a lazy job.
[deleted] ยท 90 points ยท Posted at 22:56:12 on May 9, 2015 ยท (Permalink)
Laziness in programming isn't the same as normal laziness.
nermid ยท 37 points ยท Posted at 23:24:52 on May 9, 2015 ยท (Permalink)
It is, but only in theory.
xkcd_transcriber ยท 27 points ยท Posted at 23:25:02 on May 9, 2015 ยท (Permalink)
Image
Title: Automation
Title-text: 'Automating' comes from the roots 'auto-' meaning 'self-', and 'mating', meaning 'screwing'.
Comic Explanation
Stats: This comic has been referenced 178 times, representing 0.2829% of referenced xkcds.
xkcd.com | xkcdย sub | Problems/Bugs? | Statistics | Stopย Replying | Delete
bacondev ยท 5 points ยท Posted at 01:19:21 on May 10, 2015 ยท (Permalink)
Writing a program clever to enough to allow yourself to be lazy thoughโฆ
Besides, isn't that what programming is? Writing code that will allow one to be lazy?
amunak ยท 1 points ยท Posted at 13:19:54 on May 10, 2015 ยท (Permalink)
lazy or unemployed, yes.
RobKhonsu ยท 3 points ยท Posted at 01:47:41 on May 10, 2015 ยท (Permalink)
I also say: "Never underestimate my devotion to make things lazy."
wolfman1911 ยท 105 points ยท Posted at 20:00:33 on May 9, 2015 ยท (Permalink)
That's the problem with statements like 'be creative'. Some of the most creative people you'll ever meet are also very, very lazy.
Mr_chiMmy ยท 70 points ยท Posted at 20:37:01 on May 9, 2015 ยท (Permalink)
That's basically how to describe a good programmer, a lazy creative person. Keep it simple.
Kussie ยท 50 points ยท Posted at 22:29:56 on May 9, 2015 ยท (Permalink)
It's not lazy its efficiency
NoShftShck16 ยท 31 points ยท Posted at 00:19:40 on May 10, 2015 ยท (Permalink)
Right. There is a big difference. Lazy is not wanting to do a task. Efficient is not having to do any task more than what's necessary. Even when it means more works up front.
IWillNotLie ยท 14 points ยท Posted at 06:04:15 on May 10, 2015 ยท (Permalink)
Yes, but inefficient people can't wrap their minds around the concept called efficiency, so they call us lazy and uncultured.
cleroth ยท 1 points ยท Posted at 01:36:22 on May 11, 2015 ยท (Permalink)
Work smart, not hard.
Still, it can be a bit of laziness. You may want to be more efficient because you're too lazy to do the less efficient way.
MegaMonkeyManExtreme ยท 10 points ยท Posted at 08:59:52 on May 10, 2015 ยท (Permalink)
Efficiency is intelligent laziness.
daggerdragon ยท 6 points ยท Posted at 22:31:25 on May 9, 2015 ยท (Permalink)
Can confirm, am lazy creative programmer. I'd like to think I'm good, though...
FAcup ยท 1 points ยท Posted at 13:53:41 on May 12, 2015 ยท (Permalink)
antidense ยท 4 points ยท Posted at 23:11:42 on May 9, 2015 ยท (Permalink)
Laziness is the mother of invention
ccricers ยท 2 points ยท Posted at 01:30:36 on May 10, 2015 ยท (Permalink)
Working smart, not hard.
c3534l ยท 620 points ยท Posted at 16:26:32 on May 9, 2015 ยท (Permalink)
What a bullshit question, and especially to leave a snarky comment on their paper for what's the objectively simplest and most elegant solution.
Silverhand7 ยท 252 points ยท Posted at 16:53:47 on May 9, 2015 ยท (Permalink)
Yeah, I feel like this is a really shitty teacher. They should realize that they made a bad question, not blame the student for it.
G3Kappa ยท 154 points ยท Posted at 17:32:34 on May 9, 2015 ยท (Permalink)
Everyone is jumping to conclusions, though. While it's true that the teacher wrote Really?, they could still have given points to the student.
TwinkyTheBear ยท 111 points ยท Posted at 18:28:22 on May 9, 2015 ยท (Permalink)
Their dynamic could also be more complicated than we can see as outside observers.
nermid ยท 49 points ยท Posted at 23:18:23 on May 9, 2015 ยท (Permalink)
Could not replicate teacher/student relationship. Ticket closed.
Narfubel ยท 97 points ยท Posted at 19:18:27 on May 9, 2015 ยท (Permalink)
Bullshit I have seen one word on paper and that's all I need to see to make a full judgement of everyone involved! /s
lowleveldata ยท 5 points ยท Posted at 04:49:31 on May 10, 2015 ยท (Permalink)
well I mean, this is internet not court
n1c0_ds ยท 3 points ยท Posted at 10:16:29 on May 10, 2015 ยท (Permalink)
We could have a bot that only says this
[deleted] ยท 0 points ยท Posted at 22:55:13 on May 9, 2015 ยท (Permalink)
You ruined it
[deleted] ยท 0 points ยท Posted at 00:52:18 on May 10, 2015 ยท (Permalink)
This is a programming subreddit, it's not like we understand the intricacies of interpersonal relationships here.
ThisPromptIsThisLong ยท 30 points ยท Posted at 19:45:34 on May 9, 2015 ยท (Permalink)
Plus it wasn't marked wrong. Likely they still got credit.
bacondev ยท 0 points ยท Posted at 01:16:30 on May 10, 2015 ยท (Permalink)
At least not that we could tell.
Ph0X ยท 10 points ยท Posted at 22:16:44 on May 9, 2015 ยท (Permalink)
Yeah, my guess is that it was a fun last question to see what crazy sort of stuff some kids come up with, and it probably didn't really count for any points.
avenger2142 ยท 3 points ยท Posted at 22:54:33 on May 9, 2015 ยท (Permalink)
Its reddit, what do you expect?
tru3gam3r ยท 3 points ยท Posted at 01:30:08 on May 10, 2015 ยท (Permalink)
Not to mention the teacher is probably funny/sarcastic
Kyyni ยท 1 points ยท Posted at 09:23:45 on May 10, 2015 ยท (Permalink)
As evidenced by putting this kind of questions on the goddamn test.
PokeBottom ยท 49 points ยท Posted at 18:44:02 on May 9, 2015 ยท (Permalink)
By the handwriting I am assuming the teacher is super hot, and impressed with how smart the student is.
[deleted] ยท 48 points ยท Posted at 19:13:16 on May 9, 2015 ยท (Permalink)*
[deleted]
LobsterThief ยท 27 points ยท Posted at 20:19:33 on May 9, 2015 ยท (Permalink)
"But I'm 10"
Foob70 ยท 27 points ยท Posted at 21:44:44 on May 9, 2015 ยท (Permalink)
"Fine then I'll bring the wine"
I_miss_your_mommy ยท 9 points ยท Posted at 21:22:45 on May 9, 2015 ยท (Permalink)
I'm a 10 too!
sorrowfalling ยท 7 points ยท Posted at 20:27:35 on May 9, 2015 ยท (Permalink)
"There's $100 and a box of condoms under the sink."
NearlyPerfect ยท 5 points ยท Posted at 20:47:34 on May 9, 2015 ยท (Permalink)
Nice.
[deleted] ยท 23 points ยท Posted at 20:40:27 on May 9, 2015 ยท (Permalink)
That's a pretty big statement for having so little to go on. Seriously, it was one poorly worded/ poorly thought out question on a test.
Silverhand7 ยท -6 points ยท Posted at 20:43:28 on May 9, 2015 ยท (Permalink)
I said that more because of their response and the condescending attitude towards a student.
CrazedToCraze ยท 7 points ยท Posted at 23:48:17 on May 9, 2015 ยท (Permalink)
You only think it's condescending because you have literally no context on both the test and the relationship between the student and teacher
Kyyni ยท 1 points ยท Posted at 09:27:50 on May 10, 2015 ยท (Permalink)
For all we know, he might have still gotten full marks on that one, the "really?" could just be a humorous, snarky remark, part of the student/teacher dynamic.
I know I always left snarky remarks for my philosophy teacher on any questions even slightly ambiguous, and she wrote snarky comments back, but still gave my full points where I deserved it. And don't even get me started on my maths teacher, if someone who didn't know what was going on took a look at our conversations, they could have mistaken them for a raging of fights one-upmanship over who was more right on a subject, but we both had fun, and I got good grades.
[deleted] ยท 2 points ยท Posted at 01:29:25 on May 10, 2015 ยท (Permalink)
Notice the question isn't marked wrong.. They simply wrote "Really?" on the paper. How can you make such an accusation without knowing any of the context?
salgat ยท 2 points ยท Posted at 22:00:04 on May 9, 2015 ยท (Permalink)
I'm going to go ahead and say you'd have to be pretty simple to not understand the intent of the question. Look up the definition of "smartass".
[deleted] ยท -3 points ยท Posted at 19:21:14 on May 9, 2015 ยท (Permalink)
[deleted]
[deleted] ยท 4 points ยท Posted at 19:48:40 on May 9, 2015 ยท (Permalink)*
[deleted]
Guyag ยท 2 points ยท Posted at 19:57:01 on May 9, 2015 ยท (Permalink)
Oh fair enough, misinterpreted
erilol ยท 1 points ยท Posted at 20:38:49 on May 9, 2015 ยท (Permalink)
Upvoting because your misunderstanding and the subsequent clarification contribute to the thread.
Thoguth ยท 0 points ยท Posted at 21:22:11 on May 9, 2015 ยท (Permalink)
Upvoting this because
Most people don't get that a well-meant, constructive but incorrect statement is more valuable than a rah-rah statement, and insipid try-funny statement, or a tangential Simpsons quote in terms of value to the conversation, and sadly they'll upvote crap and downvote useful contributions.
While "Upvoting because" comments are typically also non-contributions to the conversation, this one appears to be made with the intention of contributing to ideas that I also would like to support.
[deleted] ยท -31 points ยท Posted at 17:49:23 on May 9, 2015 ยท (Permalink)
I hold that a student's duty is not to get as many points with as little work as possible, a student's duty is to learn and demonstrate learning. If you fail to interpret the question in a way that allows you to demonstrate learning, you do not deserve any points.
I applaud the teacher.
[deleted] ยท 23 points ยท Posted at 17:55:10 on May 9, 2015 ยท (Permalink)
You aren't any fun outside parties either.
[deleted] ยท -19 points ยท Posted at 17:56:26 on May 9, 2015 ยท (Permalink)
[removed]
[deleted] ยท 11 points ยท Posted at 18:21:06 on May 9, 2015 ยท (Permalink)
And this student is demonstrating that they understand that "equation" is any expression with an equals sign in it. It's definitely a good demonstration that they understand the concept. So well, in fact, that even within a context intended to obfuscate that fact, they still hold the true meaning in mind.
By your own criteria, this student did an outstanding job.
[deleted] ยท 9 points ยท Posted at 18:25:24 on May 9, 2015 ยท (Permalink)
[deleted]
[deleted] ยท -1 points ยท Posted at 18:28:30 on May 9, 2015 ยท (Permalink)
That's true of real life problems. But when the actual problem is not the stated problem, but "use this as a prompt to demonstrate that you have learned and/or acquired ability from your studies", that is no longer the case. And that is the purpose of a test, not solving some problem that has been solved millions of times before.
That's probably a good reason why academic success does not correlate to productive ability.
ppooiiuuyyttrreewwqq ยท 1 points ยท Posted at 19:01:27 on May 9, 2015 ยท (Permalink)
You make a very valid point.
[deleted] ยท 9 points ยท Posted at 17:59:55 on May 9, 2015 ยท (Permalink)
Of course it isn't!
We just like to be efficient is all
Kinje ยท 4 points ยท Posted at 18:05:48 on May 9, 2015 ยท (Permalink)
I'm torn between upvoting for novelty account or downvoting for being no fun.
[deleted] ยท 1 points ยท Posted at 18:11:57 on May 9, 2015 ยท (Permalink)
Feel free to downvote. It's not really a novelty account, I'm actually just no fun, and it's what I really believe.
I certainly feel more free to express my curmudgeonly side since I switched from my previous username, though.
OmegaVesko ยท 5 points ยท Posted at 18:27:48 on May 9, 2015 ยท (Permalink)*
Does this answer really not demonstrate learning? If anything, a student who is actually capable of this sort of out-of-the-box thinking - and knows enough to point out that x = 7 is an equation itself - is probably doing well in this class anyhow.
seymorezipcode ยท 1 points ยท Posted at 20:22:22 on May 9, 2015 ยท (Permalink)
This would make a great interview question. See how far the minimum gets you in life...
seetadat ยท 10 points ยท Posted at 18:28:09 on May 9, 2015 ยท (Permalink)
"We need to talk about your flair."
Mofrosho ยท 1 points ยท Posted at 02:02:26 on May 10, 2015 ยท (Permalink)
okay.....sooo......more?
[deleted] ยท 32 points ยท Posted at 17:50:35 on May 9, 2015 ยท (Permalink)*
It's not a bullshit question, really, it shows the teacher is worried if students are actually understanding what an equation is, instead of simply following patterns to solve it.
He obviously didn't expect a student to pull a "technically correct", which is not to say he gave him a 0 for it, but it defeats the purpose.
Or not, I'm not sure if it shows the kid understand what an equation is or not.
ThePedanticCynic ยท 13 points ยท Posted at 18:19:18 on May 9, 2015 ยท (Permalink)
Well, he wrote an equation, so i'm willing to bet he knows what one is.
[deleted] ยท 13 points ยท Posted at 18:12:30 on May 9, 2015 ยท (Permalink)
"He obviously didn't expect a student to pull a "technically correct"...". The question reads "... you can make the equation as simple or complex as you want". You should expect a student to answer your question within the parameters of which you ask.
c3534l ยท 2 points ยท Posted at 18:15:50 on May 9, 2015 ยท (Permalink)
I don't think you should be giving vague questions where even you can't predict what a correct answer might look like. If the teacher wanted to see if students understood what an equation was, they could have easily come up with a different question; arrange "x", "sqrt(49)", "y", "0" into an equation; or perhaps "Which of the following choices is an equation"; or even "In a sentence or two, explain the difference between a statement and an equation."
[deleted] ยท 7 points ยท Posted at 19:19:48 on May 9, 2015 ยท (Permalink)*
[deleted]
Jazztoken ยท 0 points ยท Posted at 21:55:20 on May 9, 2015 ยท (Permalink)
"x=7" is a combination of addition, subtraction, multiplication, and division. Student could have pulled the same trick and been just as correct.
shieldvexor ยท -1 points ยท Posted at 00:18:28 on May 10, 2015 ยท (Permalink)
Actually it contains none of those so it is the absence of them. Combination indicates that 2 or more are present; although, it would be a dick move to slight a child for just using one of those.
Jazztoken ยท 3 points ยท Posted at 01:48:03 on May 10, 2015 ยท (Permalink)
Consider the subspace spanned by some vectors. Any vector in that subspace must be a linear combination of those vectors, but the zero vector must also exist. Therefore, absence of set members does not imply the object isn't a combination of the set members.
I guess I can be downvoted and you can have a sense of superiority, but combinations with absent terms exist throughout mathematics- and considering this is a thread about being technically correct...
I_ate_a_milkshake ยท 6 points ยท Posted at 21:15:37 on May 9, 2015 ยท (Permalink)
I think the simplest solution would be 0=0. Which is in fact true when x=7.
G3Kappa ยท 30 points ยท Posted at 17:30:46 on May 9, 2015 ยท (Permalink)
It may not be as elegant but makes the equation easier to maintain as time passes.
[deleted] ยท 39 points ยท Posted at 18:24:51 on May 9, 2015 ยท (Permalink)
That's not an equation.
That's a snippet of code that sets x to 7.
Superafluid ยท 5 points ยท Posted at 19:54:23 on May 9, 2015 ยท (Permalink)
x = X_DEFAULT_VALUE;
Is true, since the "=" operator returns a pointer to its left hand parameter, which in this case is not Null. Any value != Null is treated as true in C++.
Still not an equation though.
omegian ยท 6 points ยท Posted at 21:29:22 on May 9, 2015 ยท (Permalink)
Not quite, an assignment expression returns the rvalue.
At any rate, it isn't an equation since a C++ compiler can't parse x + 1 = 7;
Kyyni ยท 2 points ยท Posted at 09:42:46 on May 10, 2015 ยท (Permalink)
No, the assignment operator, by default returns a reference to the assignee, that is, the left hand side of the assignment. Source. Basically it works the same way, though.
The assignment operator is right-associative, so a chained assignment like
resolves to
which functions like
omegian ยท 1 points ยท Posted at 19:16:18 on May 11, 2015 ยท (Permalink)*
Sorry, lvalue, not rvalue. It isn't a pointer though.
za419 ยท 1 points ยท Posted at 22:33:36 on May 9, 2015 ยท (Permalink)
Only because
x + 1is recognized as an rvalue.+does take precedence over=, but since it's not an lvalue, you can't set 7 to the temporary copy.Superafluid ยท 1 points ยท Posted at 07:04:16 on May 10, 2015 ยท (Permalink)
Really? I thought it would return a pointer, so you are able to chain assignments.
x = y = 2;
Kyyni ยท 1 points ยท Posted at 09:43:35 on May 10, 2015 ยท (Permalink)
Close, but it's a reference.
Superafluid ยท 1 points ยท Posted at 09:46:32 on May 10, 2015 ยท (Permalink)
Thanks! All that Java made me forget the difference between pointers and references.
omegian ยท 1 points ยท Posted at 19:25:33 on May 11, 2015 ยท (Permalink)
If it were a pointer, you'd need to do this:
x = * ( y = 2 )
Plasma_000 ยท 7 points ยท Posted at 20:57:52 on May 9, 2015 ยท (Permalink)
nah, i think the simplest solution would be 0=0. A for effort though
isinned ยท 2 points ยท Posted at 09:04:33 on May 10, 2015 ยท (Permalink)
Depends how you define "simplest solution".
x = 7is the laziest solution because it was already given as an answer, which makes it simpler than thinking of another solution IMO.Plankton_loves_Karen ยท 2 points ยท Posted at 22:45:01 on May 9, 2015 ยท (Permalink)
It may have been snarky, but, at least she didn't mark it wrong. Right?
FuckWhereDidIThrowit ยท 2 points ยท Posted at 04:40:24 on May 10, 2015 ยท (Permalink)
Interesting, I didn't see it coming off as snarky. I imagine it more as the teacher being more amused and "groaning" at the student's solution.
The question seems like its also a bonus point or extra question, so that could explain some things.
Regardless, neither of us know jackshit about the situation at hand, so theres no point shitting on the teacher and jumping to conclusions.
HumusTheWalls ยท 1 points ยท Posted at 02:46:35 on May 10, 2015 ยท (Permalink)
I mean, 0 = 0 could be simpler and more elegant, since it works for all values of x.
amunak ยท 1 points ยท Posted at 13:21:45 on May 10, 2015 ยท (Permalink)
I'd argue that 0=0, x=x or even a=a is simpler / more elegant, but you are right, it's BS.
[deleted] ยท 1 points ยท Posted at 22:24:26 on August 17, 2015 ยท (Permalink)
Simplest will always be x=x :)
oli_rain ยท 1 points ยท Posted at 20:47:06 on May 9, 2015 ยท (Permalink)
Specially when any true equation is a good answer like. 1+1=2 is true when x =7
[deleted] ยท 0 points ยท Posted at 21:20:03 on May 9, 2015 ยท (Permalink)*
[deleted]
shieldvexor ยท 2 points ยท Posted at 00:18:54 on May 10, 2015 ยท (Permalink)
Not an equation though.
aliceandbob ยท 2 points ยท Posted at 00:26:27 on May 10, 2015 ยท (Permalink)
Hmm... according to wiki an equation is
So I suppose it should rather be 'x = x'?
Cley_Faye ยท 29 points ยท Posted at 19:30:39 on May 9, 2015 ยท (Permalink)
"Incapable of overcomplicating things, will never reach management level in society".
[deleted] ยท 151 points ยท Posted at 16:54:29 on May 9, 2015 ยท (Permalink)*
[deleted]
charredgrass ยท 146 points ยท Posted at 17:02:47 on May 9, 2015 ยท (Permalink)
Technically some of those are inequalities.
WorseThanHipster ยท 137 points ยท Posted at 17:08:25 on May 9, 2015 ยท (Permalink)
Hey, it's the 21st centrury, lets not be symbolisist here.
#YesAllComparisonOperators
phaseMonkey ยท 13 points ยท Posted at 20:49:54 on May 9, 2015 ยท (Permalink)
#xlivesmatter
nermid ยท 3 points ยท Posted at 23:21:44 on May 9, 2015 ยท (Permalink)
#carrythatcarry
2Punx2Furious ยท 23 points ยท Posted at 17:44:23 on May 9, 2015 ยท (Permalink)
Can you ELI13 the last one?
FightThePurple ยท 75 points ยท Posted at 17:49:44 on May 9, 2015 ยท (Permalink)
It's just the definition of ez, using a taylor series. Totally irrelevant but true when x=7.
2Punx2Furious ยท 59 points ยท Posted at 18:09:59 on May 9, 2015 ยท (Permalink)
I guess I should have kept it as ELI5.
Future_Daydreamer ยท 18 points ยท Posted at 18:27:12 on May 9, 2015 ยท (Permalink)
The stuff at the beginning basically means n starts at 0 and continues to infinity. The equation after that zn / n! equals ez as n goes to infinity and the equations for each value of n are summed. Z0 / 0! + z1 / 1! + z2 / 2! + ... + zn / n! = ez
Edited for formatting
Tywien ยท 8 points ยท Posted at 19:14:48 on May 9, 2015 ยท (Permalink)
i guess the problem is the formatting. In a properly formatted equation there woule be
n = 0below the sigma and the infinity symbol above it .. i too had to think what that should mean._DasDingo_ ยท 7 points ยท Posted at 19:20:57 on May 9, 2015 ยท (Permalink)*
In case you don't know e: It is a constant value with some useful characteristics. For example, f(x)=ex is a function that has itself as derivation. But like pi, you can't write it down due to its infinite numbers after the point.
The definition above is a way to describe e. Set z = 1 and you get
n|0โโโ(1n /n!) = e1 = e
In words, you sum up all (1/n!) terms (with n = 0,1,2,3,...,โ) and get e:
(1/1) + (1/1) + (1/2) + (1/6) + (1/24) + ... + (1/โ!) = e
But the definition is more general, you can describe every ez you want, just set z
n|0โโโ(zn /n!) = (z0 /0!) + (z1 /1!) + (z2 /2!) + (z3 /3!) + (z4 /4!) + ... + (zโ /โ!) = ez
Edit: ex is not the only function with f(x)=f'(x), fuck me.
[deleted] ยท 6 points ยท Posted at 23:33:44 on May 9, 2015 ยท (Permalink)
[deleted]
_DasDingo_ ยท 2 points ยท Posted at 10:15:41 on May 10, 2015 ยท (Permalink)
Damnit, you got me
miningrush ยท -1 points ยท Posted at 23:02:34 on May 9, 2015 ยท (Permalink)
I really love nitpicking so could you please give me the derivation of f(x)=0 and look for a very small mistake in your comment? I would also like a downvote, so people won't have to read my silly and selfish comment.
I_RATE_YOUR_BEWBS ยท 3 points ยท Posted at 23:01:14 on May 9, 2015 ยท (Permalink)
I'm not sure it's possible to explain the taylor series to a five-year-old...
2Punx2Furious ยท 1 points ยท Posted at 23:33:49 on May 9, 2015 ยท (Permalink)
Would it be possible to explain to an old person?
I_RATE_YOUR_BEWBS ยท 5 points ยท Posted at 23:45:43 on May 9, 2015 ยท (Permalink)
It's not about age, it's about having quite a bit of knowledge about analysis.
http://en.wikipedia.org/wiki/Taylor_series
Basically it works something like this: You can replace any function with a sum of other functions, assuming you choose the other functions in a very clever way and scale them accordingly. If you are ready to accept a tiny bit of imprecision, it's possible to choose functions that are easy to work with. Some guy figured out how to do that in an easy way, and now nobody gives a fuck on how to do the real math any more and just uses a taylor approximation, because it's more than good enough, but is blazingly fast on PCs.
The solution to any "how can we compute this function?" is usually always "and from here we can do a taylor approximation", or "we can't".
But I can't break it down on how that actually works. That's just a bunch of proofs.
autowikibot ยท 2 points ยท Posted at 23:46:15 on May 9, 2015 ยท (Permalink)
Taylor series:
Interesting: DavidonโFletcherโPowell formula | Rational function | Taylor's theorem | Polygamma function
Parent commenter can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words
cleroth ยท 2 points ยท Posted at 01:34:19 on May 11, 2015 ยท (Permalink)
Pretty sure the approximations are used because they're faster, not because we "can't do real math."
And for anyone interested, this is how a lot of CPUs do intrinsics for trigonometric functions. As you can imagine, you don't really need full accuracy for such stuff.
2Punx2Furious ยท 1 points ยท Posted at 23:56:00 on May 9, 2015 ยท (Permalink)
I see, thanks. I guess it's ok that there are things that I can't understand for now. Maybe in the future, when I'll be able to augment my brain, I'll understand these things easily.
oli_rain ยท 0 points ยท Posted at 20:48:20 on May 9, 2015 ยท (Permalink)
This is wrong , those are not all equations. You failed haha
[deleted] ยท 1 points ยท Posted at 00:38:44 on May 10, 2015 ยท (Permalink)
[deleted]
oli_rain ยท 1 points ยท Posted at 01:38:56 on May 10, 2015 ยท (Permalink)
From Wikipedia : In mathematics, anย equationย is an equality containing one or more variables. Solving theย equation consists of determining which values of the variables make the equality true.
[deleted] ยท 4 points ยท Posted at 01:53:52 on May 10, 2015 ยท (Permalink)
[deleted]
oli_rain ยท 0 points ยท Posted at 13:36:04 on May 10, 2015 ยท (Permalink)
Dude, seriously. Equations and inequations are two opposites things . Saying one is a subset of the other is like saying north is a subset of south. Here is a bridge, now get over it.
WorseThanHipster ยท 1 points ยท Posted at 14:47:31 on May 10, 2015 ยท (Permalink)
I think a lot of people, mistakenly or not, use the word equation to mean expression. You're clearly very... fastidious, to put it politely. But:
I think you should focus on that chip on your shoulder. There are real arguments to be had, and then there's this.
[deleted] ยท 24 points ยท Posted at 16:30:53 on May 9, 2015 ยท (Permalink)
This is logically sound.
vinsanity406 ยท 22 points ยท Posted at 19:12:34 on May 9, 2015 ยท (Permalink)
Every requirement from non tech product owners. "I want a login button that is blue." Then "why doesn't it change colors when I click it? Where's then loading bar? There's no error message I'd I haven't entered anything or incorrect data. There's no field validation. It doesn't remember me when I came back."
-_-_-_-__-_-_-_- ยท 22 points ยท Posted at 18:47:17 on May 9, 2015 ยท (Permalink)*
My college algebra prof was more impressed with simpler examples. If he wanted
an equationa polynomial with 8 as a solution, he would probably put "Really?" if you gave an answer likex4 -(18+3 i) x3 +(76+48 i) x2 +(72-132 i) x-(320+480 i)
CTMGame ยท 16 points ยท Posted at 20:40:38 on May 9, 2015 ยท (Permalink)
But... but you forgot the =0 part. Also, x can be equal to -2, 2+3i, 8 or 10 here. 8 is not the unambigous solution.
za419 ยท 19 points ยท Posted at 22:24:40 on May 9, 2015 ยท (Permalink)
It doesn't say "8 as the only solution"... So, theoretically, "xโC" (where C denotes the set of all complex numbers), while really really vacuous, and probably even dumber than it is vacuous, is a satisfactory answer.
-_-_-_-__-_-_-_- ยท 1 points ยท Posted at 15:00:50 on May 10, 2015 ยท (Permalink)
Sorry, mean polynomial, not equation.
We didn't actually have a problem that simple though. More along the lines of "Find a degree 2 polynomial with 4 roots in Z6"
[deleted] ยท 53 points ยท Posted at 16:41:05 on May 9, 2015 ยท (Permalink)*
0=0
edit: what? This equation is true no matter what x is.
MrMeltJr ยท 50 points ยท Posted at 21:39:41 on May 9, 2015 ยท (Permalink)*
Can confirm. 0=0 when x=7
UPDATE: Incremented and decremented x a few times, 0 was always still equal to 0. I think we're onto something here.
moretorquethanyou ยท 13 points ยท Posted at 22:45:01 on May 9, 2015 ยท (Permalink)
Now prove it exhaustively.
I_RATE_YOUR_BEWBS ยท 33 points ยท Posted at 23:03:40 on May 9, 2015 ยท (Permalink)*
Easy. Induction.
This shows that 0=0 for any integer value of x that is 0 or bigger, according to how induction works. I knew this technique would be useful at some point. Winning internet smart-ass points.
The proof for negative x or non-integer x is left as an exercise to the viewer.
[deleted] ยท 17 points ยท Posted at 23:20:39 on May 9, 2015 ยท (Permalink)
[deleted]
I_RATE_YOUR_BEWBS ยท 36 points ยท Posted at 23:39:00 on May 9, 2015 ยท (Permalink)
The value that x has to be for 0=0 to not be true has to be different from itself, which is impossible.
Good enough? I liked the proof by induction more, because it's cute.
Tysonzero ยท 1 points ยท Posted at 08:35:56 on May 10, 2015 ยท (Permalink)
Well if x != x is inherently impossible then so is 0 != 0, so:
The 0 on the left has to be different from the 0 on the right. Which is impossible.
Xgamer4 ยท 1 points ยท Posted at 20:52:24 on May 10, 2015 ยท (Permalink)
The left hand 0 is from R while the right hand 0 is from C.
Now they're different.
Tysonzero ยท 2 points ยท Posted at 21:01:09 on May 10, 2015 ยท (Permalink)
Is that really how that works? That doesn't seem right. I think they would still be the same.
Xgamer4 ยท 2 points ยท Posted at 21:19:54 on May 10, 2015 ยท (Permalink)
Er, kinda. There's a lot of different ways to look at it. It's like how, technically, int 0 and float 0 aren't the same thing.
That said, functionally, they're identical.
Tysonzero ยท 1 points ยท Posted at 21:37:50 on May 10, 2015 ยท (Permalink)
From a programming standpoint you are correct. But I am fairly certain that from a purely mathematical (sans programming) standpoint 0 is identical to 0 in every sense of the word. Seeing as math isn't strongly typed.
Xgamer4 ยท 1 points ยท Posted at 22:01:18 on May 10, 2015 ยท (Permalink)
You'd be surprised. Being an element of a set is effectively the same as being strongly typed.
Granted, most mathematicians gloss over it automatically because it's generally not important, and half the time it is important there's a relation between the sets that makes it not important (as is the case between 0 in C and 0 in R), but it's still there, and still important.
This is mostly speaking generally. Speaking specifically of 0, 0 is the general shorthand for the additive identity. If I let X and Y be additive groups, then there's a 0 in X and a 0 in Y (in that there's an additive identity in each), and we know that those elements behave similarly by virtue of both being additive identities, but you'd be remiss to say the 0s are the same thing.
In the case of R and C, it just so happens that the 0 in R and the 0 in C are functionally the same element (though not technically, as the 0 in C is technically 0+0i, as it needs to be an element of C) in that R is an additive subgroup of C and subgroups preserve the identity.
Tysonzero ยท 1 points ยท Posted at 22:43:30 on May 10, 2015 ยท (Permalink)
Well by that logic then 0 = 0 when x = 7 isn't always true, so the entire premise is flawed and we can't do the 0 + x != 0 + x thing to show that they are equal.
Either my shorter proof works or neither of them due because the statement isn't true to begin with.
Xgamer4 ยท 1 points ยท Posted at 22:47:40 on May 10, 2015 ยท (Permalink)
Well, in the context of the question we're working in R, and 0 in R is always equal to 0 in R.
I was just being a smart-ass by removing that context. There's no major problem anywhere.
Tysonzero ยท 1 points ยท Posted at 22:49:58 on May 10, 2015 ยท (Permalink)
Ok so my proof does work in this context?
Xgamer4 ยท 1 points ยท Posted at 23:02:50 on May 10, 2015 ยท (Permalink)
Yeah, well enough. I mean, it's kinda a silly proof, but I think we all knew that going in.
gudoking ยท 0 points ยท Posted at 07:45:49 on May 10, 2015 ยท (Permalink)
what if x is NaN?
I_RATE_YOUR_BEWBS ยท 3 points ยท Posted at 08:12:34 on May 10, 2015 ยท (Permalink)*
That is not a valid number in mathematics. You might as well ask me what if x is a car. I have only proven it correct under the assumption that the laws of mathematics are true, which is not always the case on computer hardware. IEEE 754 is just an approximation to begin with.
cleroth ยท 1 points ยท Posted at 01:38:24 on May 11, 2015 ยท (Permalink)
What if x is a black hole?
MegaMonkeyManExtreme ยท 1 points ยท Posted at 09:20:29 on May 10, 2015 ยท (Permalink)
Don't forget 0โ -0
AcaciaBlue ยท 24 points ยท Posted at 19:12:06 on May 9, 2015 ยท (Permalink)
dumb questions deserve dumb answers.. so few teachers realize that.
cleroth ยท 1 points ยท Posted at 01:39:26 on May 11, 2015 ยท (Permalink)
So when my employer asks me how to do something stupid, I tell him something stupid. Got it.
AcaciaBlue ยท 1 points ยท Posted at 02:06:00 on May 11, 2015 ยท (Permalink)
teachers are supposed to ask questions that provoke thought, nobody ever said every shitty job would be the same.
cleroth ยท 1 points ยท Posted at 02:09:27 on May 11, 2015 ยท (Permalink)
Being completely serious in every occasion is how not to teach.
Besides, you can't perfect every question. Teachers also make errors.
eyal0 ยท 19 points ยท Posted at 18:56:40 on May 9, 2015 ยท (Permalink)
hangingbacon ยท 7 points ยท Posted at 18:16:25 on May 9, 2015 ยท (Permalink)
x=x
ILikeLenexa ยท 7 points ยท Posted at 16:06:44 on May 10, 2015 ยท (Permalink)
A true programmer would have picked x=x. It's portable to all values of x.
HINDBRAIN ยท 1 points ยท Posted at 22:45:15 on July 1, 2015 ยท (Permalink)
Fails for JS NaN and SQL null.
oli_rain ยท 5 points ยท Posted at 20:47:19 on May 9, 2015 ยท (Permalink)
1+1=2
ClickHereForBacardi ยท 11 points ยท Posted at 20:53:18 on May 9, 2015 ยท (Permalink)
I thought about this the last time it was posted: What kind of dick "really?"s the student providing the most efficient, most correct answer to the question.
If equation meant other equation, fucking say so instead of being snarky when you get a correct answer that isn't the one you were planning for.
amunak ยท 1 points ยท Posted at 13:28:01 on May 10, 2015 ยท (Permalink)
It's a dumb question. Even if they asked for different equation, you could still just use something like 0=0, y=y and such.
Tuhljin ยท 1 points ยท Posted at 03:11:09 on May 10, 2015 ยท (Permalink)
My friends and family say "Really?" to each other all the time and no one is offended. Poking a little fun like that is, well, all in good fun. As long as the teacher didn't mark it wrong, I don't see the problem.
ClickHereForBacardi ยท 2 points ยท Posted at 06:48:48 on May 10, 2015 ยท (Permalink)
Written feedback from a teacher to a student is totally the same as friends joking around.
Tuhljin ยท 2 points ยท Posted at 07:19:18 on May 10, 2015 ยท (Permalink)
What kind of teachers have you been cursed with all your life? Or perhaps more to the point, how thin must your skin be to get offended by something so harmless as this without even knowing anything else about this particular teacher?
[deleted] ยท -2 points ยท Posted at 08:21:13 on May 10, 2015 ยท (Permalink)
[deleted]
Tuhljin ยท 1 points ยท Posted at 08:57:12 on May 10, 2015 ยท (Permalink)
I already pointed out how your previous interpretations and assumptions were bad, and now you want to add to the pile against you?
ClickHereForBacardi ยท 0 points ยท Posted at 09:07:56 on May 10, 2015 ยท (Permalink)
You countered my assumptions with assumptions and that's okay :)
Tuhljin ยท 2 points ยท Posted at 09:57:02 on May 10, 2015 ยท (Permalink)*
The fact is that you made a bad assumption about me and you made an assumption, bad or not (but certainly unfair enough), about the teacher. The only assumption I'm making is that you're just trolling now because you're stubborn and have nothing really relevant to add, and that assumption seems justified given what you just posted.
organic ยท 6 points ยท Posted at 17:01:51 on May 9, 2015 ยท (Permalink)
true
csm10495 ยท 6 points ยท Posted at 20:27:55 on May 9, 2015 ยท (Permalink)
It says it can be as simple as you want. This is pretty darn simple.
EatAllTheWaffles ยท 5 points ยท Posted at 21:12:37 on May 9, 2015 ยท (Permalink)
x=7
7=7
(7=7)/7
1=1
cleroth ยท 1 points ยท Posted at 01:41:52 on May 11, 2015 ยท (Permalink)
Wait what?
EatAllTheWaffles ยท 1 points ยท Posted at 02:55:19 on May 11, 2015 ยท (Permalink)
Divide the whole equation by 7, so
cleroth ยท 1 points ยท Posted at 02:59:04 on May 11, 2015 ยท (Permalink)
I don't remember ever seeing that anywhere. Usually it has to be added to both sides. Maybe I'm just rusty.
Wodashit ยท 7 points ยท Posted at 19:27:55 on May 9, 2015 ยท (Permalink)
technically you could go with y= anything, if you do not express x in there the expression is true for any x, especially if x=7.
omegian ยท -1 points ยท Posted at 21:36:56 on May 9, 2015 ยท (Permalink)
You really can't. The veracity of an equation with an unresolved variable is unknown.
crossanlogan ยท 4 points ยท Posted at 22:38:31 on May 9, 2015 ยท (Permalink)
there are no unresolved variables. if you say y=19, then make x=7 and say "what's y?" y will still be 19.
omegian ยท 0 points ยท Posted at 01:49:28 on May 10, 2015 ยท (Permalink)
Correct, so the equation "y = 7" is false when x = 7 and y = 19. It is a line, not a plane.
crossanlogan ยท 0 points ยท Posted at 03:30:50 on May 10, 2015 ยท (Permalink)
yeah, if you're talking cartesian geometry. if they're totally unrelated variables, then it's moot. replace x with $num_of_beers and y with $percent_chance_she_will_have_sex_with_me and that might make more sense
omegian ยท 2 points ยท Posted at 19:28:07 on May 11, 2015 ยท (Permalink)
No, let's not. You claim
y + 0 * x ?= n
is always true because you reduced the coefficient of x to zero. The potentisl solution space is the x-y plane, and the solution is independent of x, but not of y.
crossanlogan ยท 0 points ยท Posted at 20:12:06 on May 11, 2015 ยท (Permalink)
but you're looking at this functionally. if we were talking about solution sets, then yeah that's totally right. but we're talking about variables in which you can store values. like i said, if we hadn't defined the variables as x and y it would make more sense.
it's like saying that we're making a sandwich, so we define variables for number of slices of cheese and number of slices of ham. now, hamSlices is completely independent of cheeseSlices unless and until we choose to graph them or create a mathematical function using them. we can make cheeseSlices equal 7 and then we can set hamSlices to literally anything we want and cheeseSlices will still be 7.
omegian ยท 2 points ยท Posted at 15:25:28 on May 12, 2015 ยท (Permalink)*
How do you know when an equation is true? By evaluating both sides and comparing the values. If there are variables in one side of the equation, you have plug in values before you can evaluate it.
Yes, if you introduce a second variable with a zero coefficient, then the solution is independent of it.
x + 0 * y ?= 7
Is true when x is 7 and "whatever" for y. That's not what /u/Wodashit proposed as the solution though, it was
y ?= n
For the solution which, I said way the hell back when, the truth of that statement is indeterminate because the value of y is undefined, and unconstrained, so it could be true or false. Whether x is 7 or not.
If he meant to say: "x = 7" is a solution, and it is completely independent of the value of y! Well, no kidding. It is the preexisting solution that's already written down, and why the teacher wrote "Really?".
Yes, I understand the concept of independent variables / orthogonal axes and the set of possible solutions, its the basis for calling the proposed solution incorrect.
Let me make this much simpler and remove the second variable.
old: f(x) = x new: f(x) = 3
f(7) ?= 7
false
You would have to write 3 = 3, not introduce an undefined variable and compare it to a constant.
If the variables are truly independent, then knowing how many slices of ham are on the sandwich (or not) tells you nothing about how many slices of cheese are on the sandwich. Can you truly answer this question?
"There are seven slices of ham on the sandwich. Are there three slices of cheese on the sandwich?"
If not, you will understand why a system of equations with two unknowns in insoluble without a second equation.
y = 2x, y ?= 14
This is true when x = 7. The value of y is no longer unresolved.
[deleted] ยท 19 points ยท Posted at 15:59:57 on May 9, 2015 ยท (Permalink)
[deleted]
WorseThanHipster ยท 35 points ยท Posted at 17:00:14 on May 9, 2015 ยท (Permalink)
This isn't technically true; too many degrees of freedom to have 'truth'.
El_Dumfuco ยท 7 points ยท Posted at 19:10:34 on May 9, 2015 ยท (Permalink)
and where's the x?
fuzzyfuzz ยท 12 points ยท Posted at 20:27:56 on May 9, 2015 ยท (Permalink)
It's equal to 7.
LobsterThief ยท 3 points ยท Posted at 20:21:50 on May 9, 2015 ยท (Permalink)
He should have followed with x = y
JViz ยท 3 points ยท Posted at 21:53:04 on May 9, 2015 ยท (Permalink)
The question can be interpreted as fiat. The flexibility given means that the answer is stating itself as true as long as the one condition is met, which it was.
[deleted] ยท 1 points ยท Posted at 19:24:28 on May 11, 2015 ยท (Permalink)
This is what I would do... make something so complicated that the teacher would spend hours trying to check if it is correct.
robhol ยท 6 points ยท Posted at 21:46:53 on May 9, 2015 ยท (Permalink)
Even better, x=x - it doesn't say "true if-and-only-if x is 7"
amunak ยท 5 points ยท Posted at 13:28:45 on May 10, 2015 ยท (Permalink)
Or just y=y or 0=0. Who needs x.
dokks ยท 3 points ยท Posted at 19:51:54 on May 9, 2015 ยท (Permalink)
Really hope she gave him credit for that.
s3vv4 ยท 3 points ยท Posted at 20:31:08 on May 9, 2015 ยท (Permalink)
0=0
rubyton ยท 1 points ยท Posted at 04:15:03 on May 11, 2015 ยท (Permalink)
I think this is a better answer
komocode ยท 3 points ยท Posted at 23:08:40 on May 9, 2015 ยท (Permalink)
today, we need /r/really
kesuaus ยท 3 points ยท Posted at 14:28:11 on July 22, 2015 ยท (Permalink)
My teacher would let me fail the whole class if I wrote a shit like this. Because he would take it personally as in "you want to fuck with me boy? I'll show you how I can fuck with you"
[deleted] ยท 5 points ยท Posted at 04:34:27 on May 10, 2015 ยท (Permalink)
Definitely not an enterprise Java programmer though
[deleted] ยท 6 points ยท Posted at 21:44:03 on May 9, 2015 ยท (Permalink)
This one is going to hit him hard
toaster_waffle ยท 14 points ยท Posted at 15:22:51 on May 9, 2015 ยท (Permalink)
a=7
x=a
TarMil ยท 68 points ยท Posted at 15:56:21 on May 9, 2015 ยท (Permalink)
That's not an equation, that's two equations.
galaktos ยท 19 points ยท Posted at 16:45:28 on May 9, 2015 ยท (Permalink)
(syntax may vary depending on programming language of preference)
minno ยท 21 points ยท Posted at 16:58:34 on May 9, 2015 ยท (Permalink)
He asked for math, not...well, it's functional. Close enough.
markevens ยท 4 points ยท Posted at 19:19:41 on May 9, 2015 ยท (Permalink)
I love how the comment indicates that the teacher didn't mark it wrong.
nostalgicBadger ยท 5 points ยท Posted at 19:50:55 on May 9, 2015 ยท (Permalink)
It's not wrong. The question even says "you can make it as simple ... as you want".
2663999 ยท 2 points ยท Posted at 21:05:22 on May 9, 2015 ยท (Permalink)
0x=0
[deleted] ยท 4 points ยท Posted at 18:32:43 on May 9, 2015 ยท (Permalink)
7=x
Firehead94 ยท 4 points ยท Posted at 02:44:39 on May 10, 2015 ยท (Permalink)
x == 7
Lambaline ยท 7 points ยท Posted at 02:45:18 on May 10, 2015 ยท (Permalink)
That's testing if x is 7.
Firehead94 ยท 6 points ยท Posted at 04:47:17 on May 10, 2015 ยท (Permalink)
and it returns true since x = 7
OscarAlcala ยท 2 points ยท Posted at 04:33:10 on May 10, 2015 ยท (Permalink)
Ok, how about
successful_syndrome ยท 2 points ยท Posted at 06:20:01 on May 10, 2015 ยท (Permalink)
Instead of "Really" should say "hired"
jogaklaa ยท 1 points ยท Posted at 22:30:15 on May 9, 2015 ยท (Permalink)
Lakota?
hangoverDOTTED ยท 1 points ยท Posted at 00:21:29 on May 10, 2015 ยท (Permalink)
But what about when x doesn't equal 7? I need to know all the cases.
[deleted] ยท 1 points ยท Posted at 00:28:22 on May 10, 2015 ยท (Permalink)
I'd give this kid extra credit. He made the simplest solution possible.
reaganveg ยท 1 points ยท Posted at 00:38:26 on May 10, 2015 ยท (Permalink)
x = the largest odd number that is not the sum of three odd primes
-bornlivedie- ยท 1 points ยท Posted at 01:58:15 on May 10, 2015 ยท (Permalink)
x * stupid_teacher = x * stupid_teacher
[deleted] ยท 1 points ยท Posted at 02:00:06 on May 10, 2015 ยท (Permalink)
X * teacher = 7 รท teacher
greatsircat ยท 1 points ยท Posted at 02:26:21 on May 10, 2015 ยท (Permalink)
Brillant
KingPickle ยท 1 points ยท Posted at 04:08:55 on May 10, 2015 ยท (Permalink)
Optimized!
Slak44 ยท -4 points ยท Posted at 15:11:18 on May 9, 2015 ยท (Permalink)
x = 6.9999999999999999 would also be true.
jP_wanN ยท 70 points ยท Posted at 16:24:29 on May 9, 2015 ยท (Permalink)*
No it wouldn't. x = 6,9ฬ would though.
Edit: Is it just my font or does the unicode combining overline character generaly look ugly?
Zagorath ยท 10 points ยท Posted at 16:35:23 on May 9, 2015 ยท (Permalink)
Nah, looks bad for me, too. The overline isn't really over the 9, it's more off to the right a little.
jP_wanN ยท 13 points ยท Posted at 16:43:47 on May 9, 2015 ยท (Permalink)
Okay... Anyway, I now know how to oฬ vฬ eฬ rฬ lฬ iฬ nฬ eฬ ฬ tฬ hฬ iฬ nฬ gฬ sฬ ฬ wฬ iฬ tฬ hฬ oฬ uฬ tฬ ฬ Hฬ Tฬ Mฬ Lฬ !
Because reddit doesn't let me use
<span style="text-decoration: overline">:(ADdV ยท 5 points ยท Posted at 18:41:59 on May 9, 2015 ยท (Permalink)
Well... how??
jP_wanN ยท 2 points ยท Posted at 19:43:43 on May 9, 2015 ยท (Permalink)*
Just ask your favorite search engineโข how to insert unicode characters. In Gtk+ (which both Firefox and Chromium / Google Chrome use) it's Ctrl+Shift+U, then type the character number in hexadecimal.
The "combining overline" is unicode character #773 for whatever reason, which is
305in hexadecimal (you'll probably find it as0x0305but that's just a different notation for the same number); there's also the "combining double macron" character, which is identified by the number35eand just looks like a wider version of the overline character.Oh, and you place combining characters after the character you want them to apply to, not before like with accent keys you press before the letter you want them to be on.
EDIT: Oh, I forgot this is /r/ProgrammerHumor. I guess whoever reads this already know what Hex is then. Gonna leave the noob explanation anyway, maybe it helps someone :)
ADdV ยท 1 points ยท Posted at 20:21:46 on May 9, 2015 ยท (Permalink)
I am, much like the post-title, a 'future programmer' so the noob explanation is very much appreciated ^
G3Kappa ยท 2 points ยท Posted at 17:34:38 on May 9, 2015 ยท (Permalink)
Yeah it depends on the font. Looks fine on Fedora, looks bad on Windows.
jP_wanN ยท 1 points ยท Posted at 18:03:30 on May 9, 2015 ยท (Permalink)
Well, I'm on arch linux... Using the Cantarell font according to
gnome-tweak-tool. Which font are you using on Fedora?an_actual_human ยท 1 points ยท Posted at 22:38:43 on May 9, 2015 ยท (Permalink)
M'font.
wonkifier ยท 1 points ยท Posted at 17:17:13 on May 9, 2015 ยท (Permalink)
Looks fine to me
[deleted] ยท 1 points ยท Posted at 17:50:35 on May 9, 2015 ยท (Permalink)
Looks fine to me. MacOS 10.10.
myplacedk ยท 0 points ยท Posted at 17:18:30 on May 9, 2015 ยท (Permalink)
It looks fine here. (Android 5.0, no funny business with the fonts.)
Steve_the_Scout ยท 5 points ยท Posted at 16:24:26 on May 9, 2015 ยท (Permalink)
Actually that would be false. You need a trailing ellipsis...
Slak44 ยท 4 points ยท Posted at 16:28:35 on May 9, 2015 ยท (Permalink)
Chrome says it's true.
Zagorath ยท 20 points ยท Posted at 16:34:52 on May 9, 2015 ยท (Permalink)
Only because Javascript's float precision isn't long enough to recognise that, mathematically, 6.9999999999999999 does not equal 7.
_omnidan_ ยท 1 points ยท Posted at 00:18:00 on May 10, 2015 ยท (Permalink)*
Period of 999 actually (mathematically) does equal 1.
Proof (assume
x = 0.999...):Source: CS math book
[deleted] ยท 39 points ยท Posted at 16:33:51 on May 9, 2015 ยท (Permalink)
[deleted]
echeese ยท 11 points ยท Posted at 16:42:49 on May 9, 2015 ยท (Permalink)
How about C++?
minno ยท 14 points ยท Posted at 17:00:07 on May 9, 2015 ยท (Permalink)
Floating point numbers are not real numbers.
cparen ยท 7 points ยท Posted at 17:15:58 on May 9, 2015 ยท (Permalink)
Actually, they're (nearly) all real numbers. In fact, they're rational numbers.
I think you mean to say that floating point arithmetic is not real arithmetic. It's an appropriation of real arithmetic, using a subset of rationals with power of two denominators.
echeese ยท -5 points ยท Posted at 17:16:40 on May 9, 2015 ยท (Permalink)
Actually, floating point numbers are more like real numbers than integers
khoyo ยท 2 points ยท Posted at 19:00:32 on May 9, 2015 ยท (Permalink)
They are actually a subset of rationals. Like rationals and integers, they are countable.
Real number aren't. The set of real number is very different from rationals, whereas rational looks a lot like integers.
iopq ยท 1 points ยท Posted at 05:57:07 on May 10, 2015 ยท (Permalink)
rationals are all real, so what he said isn't false
khoyo ยท 1 points ยท Posted at 10:01:08 on May 10, 2015 ยท (Permalink)
Integers are real too.
iopq ยท 2 points ยท Posted at 12:02:14 on May 10, 2015 ยท (Permalink)
How can integers be real if our eyes ain't real?
autowikibot ยท 1 points ยท Posted at 17:17:08 on May 9, 2015 ยท (Permalink)
Real number:
Interesting: Extended real number line | Real line | 0.999... | Totally real number field
Parent commenter can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words
BobFloss ยท 2 points ยท Posted at 17:24:23 on May 9, 2015 ยท (Permalink)
What about it?
[deleted] ยท 1 points ยท Posted at 17:42:47 on May 9, 2015 ยท (Permalink)
[deleted]
BobFloss ยท 1 points ยท Posted at 06:21:26 on May 10, 2015 ยท (Permalink)
I'm well aware of what they said. I was just pointing something out.
Treyzania ยท 1 points ยท Posted at 16:56:43 on May 9, 2015 ยท (Permalink)
Don't you need an
Fat the end?echeese ยท 1 points ยท Posted at 17:16:12 on May 9, 2015 ยท (Permalink)
No, that's only for floats, I used a double.
khoyo ยท 1 points ยท Posted at 18:55:04 on May 9, 2015 ยท (Permalink)
But...
Output :
BaconZombie ยท 2 points ยท Posted at 18:54:46 on May 9, 2015 ยท (Permalink)
Hey must be using Pentium Pro CPUs.
SUsudo ยท 1 points ยท Posted at 22:54:36 on May 9, 2015 ยท (Permalink)
x = 7;
[deleted] ยท -1 points ยท Posted at 18:53:27 on May 9, 2015 ยท (Permalink)
x+0=7+0;
rockinwaffle ยท -15 points ยท Posted at 15:39:26 on May 9, 2015 ยท (Permalink)
x = 0x7;
The_Grayphantom ยท -1 points ยท Posted at 21:07:15 on May 9, 2015 ยท (Permalink)
Well, he isn't wrong.
Serious_as_butt ยท -2 points ยท Posted at 00:33:16 on May 10, 2015 ยท (Permalink)
Teacher should eliminate the word "really" from his vocabulary to sound smarter.
Nikotiiniko ยท -2 points ยท Posted at 02:52:33 on May 10, 2015 ยท (Permalink)
Oh how I wish I had this question in one of my math tests. I would ask the teacher did he not realize how stupid the question was and list a few possible answers.
Tuhljin ยท -2 points ยท Posted at 03:12:57 on May 10, 2015 ยท (Permalink)
Of the two of you, the one acting the most stupid there (among other things) would be the one that called his teacher stupid.
Nikotiiniko ยท -1 points ยท Posted at 03:14:05 on May 10, 2015 ยท (Permalink)
So you are saying this is a valid question on a test? You do realize everyone here is making fun of this? Thanks for the downvote anyway.
Tuhljin ยท -1 points ยท Posted at 03:18:26 on May 10, 2015 ยท (Permalink)
Actually, I might not have downvoted you, but now you've earned it, hypocrite.
Oh, and FYI, that's got to be one of the most ridiculous stretches of "logic" I've ever seen. I never made or hinted at any such argument. But I guess you were desperate to make this about me instead of dealing with how stupid it is to insult your teacher. If I need to, I can appeal to popularity also and point out the fact that most people would consider that incredibly foolish.
kirakun ยท -4 points ยท Posted at 21:32:19 on May 9, 2015 ยท (Permalink)
Let's get interesting. What is the most complex equation you can write that is consistent with x = 7?
bananaskates ยท 5 points ยท Posted at 22:28:56 on May 9, 2015 ยท (Permalink)
No.
kirakun ยท -1 points ยท Posted at 23:54:15 on May 9, 2015 ยท (Permalink)
That's OK. Math is not for everyone. :)
bananaskates ยท 2 points ยท Posted at 14:31:29 on May 10, 2015 ยท (Permalink)
It's not about math. It's about the fact that there are no bounds to complexity. Your task is both needless and futile.
Miner_Guyer ยท 1 points ยท Posted at 00:27:24 on May 10, 2015 ยท (Permalink)
You can make it arbitrarily complex by adding xn to both sides for any n.
wwweagle ยท -48 points ยท Posted at 15:54:00 on May 9, 2015 ยท (Permalink)
Nah, should be x==7. Rookie mistake. Works in C sometimes through.
jshufro ยท 26 points ยท Posted at 16:49:00 on May 9, 2015 ยท (Permalink)
This here's what's called a maths test, not a Programming language.
Yeah, only if you either don't care about mutating x in your conditional block or it's already 7.
AskYous ยท 5 points ยท Posted at 16:36:10 on May 9, 2015 ยท (Permalink)
Unless it was Visual Basic.
pewpewlasors ยท -26 points ยท Posted at 17:39:52 on May 9, 2015 ยท (Permalink)
Nothing from /r/funny ever needs reposted. That place is shit, that most people filter out, because its fucking terrible.
Also, this is a repost as fuck. Seen it several times. Stop the shitposting OP.