Comment On ISelfAware, Very Thorough, Crazy Hashmaps, and More

Seeing that I somehow neglected to publish an article yesterday, I figured today would be a great day for a big ole smorgasbord of interesting code. Enjoy! [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6Next »

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 14:54 • by boog (unregistered)
323565 in reply to 323544
Siskel and Ebert:
boog:
Rocky V + Rocky II = ?

Is that the one where an aging Tommy Gunn fights a re-animated Apollo Creed?

Actually it's a Simpsons reference.

Tough crowd.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 14:54 • by Mark (unregistered)
323566 in reply to 323502
icebrain:
To those saying that 215 and 1 aren't random numbers: go study statistics.


Better yet, you go study context. In programming, it is reasonable to assume if the variable name (or comments, or specs, or requirements) call for a "random" number, they mean "a number randomly generated at the time of this execution". A constant obviously doesn't meet the criteria, even if it were generated randomly, even though it could belong to a random set, even though if you did randomly generate a number it's possible you'd get that same value on every execution.

Oh, and by the way, who claimed that 1 isn't random? I see plenty of posts takling about whether 1 is prime, but none talking about whether it's random.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 14:58 • by Mark (unregistered)
323567 in reply to 323505
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
Uh...:
public static int RANDOM_PRIME_NUMBER = 215

Ok, I see how this might be random when he entered it, but I do not see how it is prime.

Of course it's prime. Just not in base 10, or anything else you might reasonably expect. (Try 6, or 36).


Yeah... and if your compiler interprets numeric literals in base 6 or base 36, you have a point. Since it doesn't, your attempt to demonstrate math nerd cred backfires as you fail to properly distinguish notations from numbers.

In any language that code could possibly have come form, the token 215 means "the decimal number 215". Nice try.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 14:59 • by ÃÆâ€â†(unregistered)
323568 in reply to 323523
Maurits:
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
Uh...:
public static int RANDOM_PRIME_NUMBER = 215

Ok, I see how this might be random when he entered it, but I do not see how it is prime.

Of course it's prime. Just not in base 10, or anything else you might reasonably expect. (Try 6, or 36).


hex comes close... very close...

Here are the bases below 250 in which 215 is prime.

83 = 215 base 6
1181 = 215 base 24
1601 = 215 base 28
2351 = 215 base 34
2633 = 215 base 36
4283 = 215 base 46
6791 = 215 base 58
8783 = 215 base 66
11633 = 215 base 76
12251 = 215 base 78
15581 = 215 base 88
26111 = 215 base 114
30881 = 215 base 124
31883 = 215 base 126
38231 = 215 base 138
41621 = 215 base 144
43961 = 215 base 148
47591 = 215 base 154
67901 = 215 base 184
69383 = 215 base 186
91811 = 215 base 214
109751 = 215 base 234
119321 = 215 base 244
121283 = 215 base 246

You win the internets. Well-played...

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:09 • by Someone You Know
323569 in reply to 323549
ShatteredArm:
smxlong:
hatterson:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


I would rather a discussion about whether .999... == 1


They are equal.

If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

(The above is not a proof, but hopefully it's convincing enough)


Why does there have to be a number between the two?

Maybe there is a proof, but this is how I look at it:

What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


I most certainly would not.

You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:18 • by The Maths (unregistered)
323570 in reply to 323569
Someone You Know:
ShatteredArm:
smxlong:
hatterson:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


I would rather a discussion about whether .999... == 1


They are equal.

If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

(The above is not a proof, but hopefully it's convincing enough)


Why does there have to be a number between the two?

Maybe there is a proof, but this is how I look at it:

What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


I most certainly would not.

You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

What kind of moronic argument is this? I'll tell you: one by someone who knows nothing about mathematics.

We're not talking about flavors for ice cream or your favorite color for a gerbil: we're talking about math. Good ol' simple, unchanging math.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:26 • by Dude (unregistered)
323571 in reply to 323570
The Maths:
Someone You Know:
ShatteredArm:
smxlong:
hatterson:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


I would rather a discussion about whether .999... == 1


They are equal.

If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

(The above is not a proof, but hopefully it's convincing enough)


Why does there have to be a number between the two?

Maybe there is a proof, but this is how I look at it:

What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


I most certainly would not.

You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

What kind of moronic argument is this? I'll tell you: one by someone who knows nothing about mathematics.

We're not talking about flavors for ice cream or your favorite color for a gerbil: we're talking about math. Good ol' simple, unchanging math.


First off... you haven't made an argument. But that's ok, I happen to know an easy proof that doesn't involve real number density or any thing else very complicated.

0.333... = 1/3
multiply both sides by 3 and you get
0.999... = 3/3
collapse the fraction
0.999... = 1

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:29 • by Crash Magnet (unregistered)
Does 0.999... = 1?

How about

F(n) = lim(10^n - 1)/10^n, n -> oo)

Take the derivitive of num & denom.

F(n) = lim(10n/10n, n -> oo)
F(n) = 1.0

QED

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:30 • by If maths was politics (unregistered)
323573 in reply to 323521
hatterson:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


I would rather a discussion about whether .999... == 1

I suggest as a compromise: .999... is not a prime.

I think the mathematicians and the dilettants can agree on this, even though for different reasons.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:35 • by Crash Magnet (unregistered)
323574 in reply to 323572
Crash Magnet:
Does 0.999... = 1?

How about

F(n) = lim(10^n - 1)/10^n, n -> oo)

Take the derivitive of num & denom.

F(n) = lim(10n/10n, n -> oo)
F(n) = 1.0

QED


Actually, I just realized that the derivitive of 10^n is not 10n. But the derivitive of the num & denom would be the same anyway and you would still get the answer 1.0.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:36 • by fjf (unregistered)
323575 in reply to 323571
Dude:
I happen to know an easy proof that doesn't involve real number density or any thing else very complicated

Actually, real number density isn't very complicated at all. For any two different real numbers a and b, their average c=(a+b)/2 is a real number that's between them (a<c<b or b<c<a).

So for those who believe 0.999... != 1, what would be the average of those two numbers?

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:39 • by boog (unregistered)
323576 in reply to 323566
Mark:
icebrain:
To those saying that 215 and 1 aren't random numbers: go study statistics.


Better yet, you go study context. In programming, it is reasonable to assume if the variable name (or comments, or specs, or requirements) call for a "random" number, they mean "a number randomly generated at the time of this execution". A constant obviously doesn't meet the criteria, even if it were generated randomly, even though it could belong to a random set, even though if you did randomly generate a number it's possible you'd get that same value on every execution.

Oh, and by the way, who claimed that 1 isn't random? I see plenty of posts takling about whether 1 is prime, but none talking about whether it's random.

Not so fast there Mark. You don't know the requirements for this application. Perhaps the requirement was for a random number no less than 215, but no more than 215. Sure, he could have generated it at run-time, but maybe the developer was smarter than that and figured out a brilliant way of saving a few CPU cycles.

As for it being prime, several people have pointed out that 215 is a prime number in other number bases. Perhaps this developer was working in an environment that operates under one of these other number bases. He also saves himself even more CPU cycles by foregoing any business logic that might assert the number's "prime-ness".

Yes, I do believe that given these very specific and completely absurd circumstances, it's safe to say that 215 could be a random prime number and that the code we are seeing is the work of an absolute genius.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:43 • by Coyne
The guy who tested for "(1 == 0)" doesn't seem very thorough to me at all.

I mean, in some universe, this "if" could very well test false but "if (2 == 0)" might test true. What about that?

I think he should have tested all the numbers...

...like I do. ;)

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:45 • by Severity One
323578 in reply to 323490
Anonymous:
Severity One:
Unless 1 == 0, that's Java.

So I appreciate that Java supports generics now, as per my previous comment, but I have to take exception at the above statement which is patently false. The code provided is valid C# syntax, assuming one had written a custom class called HashMap<T,T>. So your assertion is false because 1 != 0 but it is still possible for that code to be C#.

</pendantry>

You just keep digging your own hole deeper, don't you?

Let's go through it:

I claim that 'Unless 1 == 0, that's Java', which can be rewritten (at least in this universe) as 'Unless false, that's Java', or 'If true, that's Java', so in short: 'That's Java'.

You claim that my claim is (and I quote) "patently false"; in other words, 'that's not Java'.

However, it has been shown that it is.

The code provided is valid C# syntax

...which doesn't mean it's not valid Java syntax as well.

Ergo, you need to pick up a bit on Boolean algebra. Why don't you submit some of your code to Alex? I'm sure we'll all appreciate it. :)

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:55 • by Coyne
323579 in reply to 323572
Crash Magnet:
Does 0.999... = 1?

How about

F(n) = lim(10^n - 1)/10^n, n -> oo)

Take the derivitive of num & denom.

F(n) = lim(10n/10n, n -> oo)
F(n) = 1.0

QED


I saw this somewhere:

Given x = .999...

Then: 10x = 9.999...

Now subtract x:

10x - x = 9.999... - .999...

Complete the subtraction:

9x = 9.000...

But the endlessly repeated 0 is redundant so:

9x = 9

Factor out the 9:

x = 1

Now, substituting the original value for x:

.999... = 1

QED

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:55 • by boog (unregistered)
323580 in reply to 323577
Coyne:
The guy who tested for "(1 == 0)" doesn't seem very thorough to me at all.

I mean, in some universe, this "if" could very well test false but "if (2 == 0)" might test true. What about that?

I think he should have tested all the numbers...

Why only compare to zero? Sure, (1 == 0) and (2 == 0) might both test false, but what about (2 == 1)?

What about numbers that should be equal but aren't? Like (1 != 1)? (2 != 2)?

I think we're looking at a cross product of all numbers A vs. all numbers B, testing for inequality when they're equal, and testing for equality when they're not. Only then will I be confident that we are "running in the correct Universe".

And now my head hurts.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:56 • by Markp
323581 in reply to 323570
The Maths:
Someone You Know:
ShatteredArm:
smxlong:
hatterson:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


I would rather a discussion about whether .999... == 1


They are equal.

If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

(The above is not a proof, but hopefully it's convincing enough)


Why does there have to be a number between the two?

Maybe there is a proof, but this is how I look at it:

What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


I most certainly would not.

You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

What kind of moronic argument is this? I'll tell you: one by someone who knows nothing about mathematics.


Well, to be fair, the person who posited that "0.999..." is the largest number that is less than 1 knows nothing about mathematics either. I don't know whether that was you or not.

The nature of real numbers is that if you give me a number "a" such that a < 1, there are always an infinite number of choices for a number "b" such that a < b < 1. That's where "real number density" comes in. There is no "largest number less than..." when dealing with real numbers.

So it was a BS premise that led to what you call a "moronic" argument.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 15:58 • by PRMan (unregistered)
Okay, in one version of ASP.NET there was a bug where Microsoft would generate a table (for a datagrid or something) that was missing the end table tag. I had to add </table> myself to ensure that it got closed.

The </div> could very well be a valid fix for something like that (not in NoScript tags however).

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:00 • by anon (unregistered)
Arnold Vriezekolk's colleague is wrong when he states that he is in the wrong universe if 1=0. He is merely operating on the wrong ring. In ℤ/ℤ, zero is clearly equal to one.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:01 • by The Maths (unregistered)
323584 in reply to 323581
I was not calling your argument moronic, I said the argument itself is moronic.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:02 • by Gargo (unregistered)
323585 in reply to 323415
Uh...:
public static int RANDOM_PRIME_NUMBER = 215

Ok, I see how this might be random when he entered it, but I do not see how it is prime.


Maybe it is intended to be used as a parameter (like a #define) to a function e.g.:


public int GetNumber(int numberType) {
if (numberType == RANDOM_PRIME_NUMBER) {
...
}
...
}

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:03 • by Someone You Know
323586 in reply to 323570
The Maths:
Someone You Know:
ShatteredArm:
smxlong:
hatterson:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


I would rather a discussion about whether .999... == 1


They are equal.

If 0.999... != 1, then by the density of the real numbers, there must be some number X where 0.999... < X < 1. Suppose such a number exists. Please show me how to write this number.

(The above is not a proof, but hopefully it's convincing enough)


Why does there have to be a number between the two?

Maybe there is a proof, but this is how I look at it:

What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?


I most certainly would not.

You haven't explained how you arrived at that conclusion; you've just stated it. If you can just say that without backing it up, then I can refute it by simply saying that 0.999... is not the largest number that is less than 1, because it's equal to 1. And if a == b, then !(a < b).

And there has to be a number between the two because between any two distinct real numbers, there is another real number. (This is what smxlong meant by "the density of real numbers".) Therefore, if 0.999... and 1 are not equal, there must be a real number between them. What is it?

What kind of moronic argument is this? I'll tell you: one by someone who knows nothing about mathematics.

We're not talking about flavors for ice cream or your favorite color for a gerbil: we're talking about math. Good ol' simple, unchanging math.


I'm sorry, but I have no idea what point you're trying to make here.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:14 • by hatterson
323587 in reply to 323528
Anonymous:
hatterson:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


I would rather a discussion about whether .999... == 1

Well, technically there is nothing to discuss because they most certainly are equal and it is a simple proof to confirm this beyond doubt. But damn, what a mindfuck eh? I remember when I first had to tackle this concept back in maths class, many years ago. Took a long time to get my head around. But once it clicked it was like a lightbulb going off in my head, I literally blurted out "fuck me!" in the middle of my maths class, directly to the lecturer. He was a bit of an old bastard and I thought he was going to go ballistic, but he just looked at me with a knowing smile and gently nodded. I had joined the club.


Oh I'm well aware that they're the same number (just different representations) I just thought it would be fun to troll a thread on that rather than on if 1 is prime.

.999... == 1 usually provides more entertaining responses to read since the is 1 prime "debate" just ends with "it's not because we said it's not."

Edit: And looking at the last page or so, I greatly succeeded.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:17 • by hatterson
323588 in reply to 323573
If maths was politics:
hatterson:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


I would rather a discussion about whether .999... == 1

I suggest as a compromise: .999... is not a prime.

I think the mathematicians and the dilettants can agree on this, even though for different reasons.


Haha, well done sir.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:24 • by Not a math major (unregistered)
323589 in reply to 323414
TGV:
I can only hope they rolled a die to ensure this was actually random

And I hope they are in a universe where 215 is actually a prime.
If you add each digit in the number it's prime: 2 + 1 + 5 = 7

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:27 • by boog (unregistered)
323590 in reply to 323578
Fair enough, it's valid syntax in both C# and Java.

But you said it is Java.
Severity One:
Unless 1 == 0, that's Java.

And you clarified your argument, for those of us who are "running in the correct Universe":
Severity One:
...so in short: 'That's Java'.

I've never heard of someone taking a snippet of code that exists in the context of a C# application and outright calling it "Java" (or vice versa). So this implies that either A) you know more about the actual habitat of this code snippet than we do, or B) you're making assumptions. I think the GP was arguing B.

I'm not saying you're wrong, I'm just suggesting that you revise your statement to avoid these silly arguments.
what Severity One should have said:
Unless 1 == 0, that's valid Java syntax.

Isn't that more accurate?

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:29 • by anon (unregistered)
323591 in reply to 323589
Not a math major:
TGV:
I can only hope they rolled a die to ensure this was actually random

And I hope they are in a universe where 215 is actually a prime.
If you add each digit in the number it's prime: 2 + 1 + 5 = 7

If 1=0.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:30 • by Not a math major (unregistered)
323592 in reply to 323591
anon:
Not a math major:
TGV:
I can only hope they rolled a die to ensure this was actually random

And I hope they are in a universe where 215 is actually a prime.
If you add each digit in the number it's prime: 2 + 1 + 5 = 7

If 1=0.
WIN!!

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:35 • by hatterson
323593 in reply to 323591
anon:
Not a math major:
TGV:
I can only hope they rolled a die to ensure this was actually random

And I hope they are in a universe where 215 is actually a prime.
If you add each digit in the number it's prime: 2 + 1 + 5 = 7

If 1=0.

This is likely the best comment I've seen on here in a good long while.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:41 • by fjf (unregistered)
323595 in reply to 323580
boog:
Coyne:
The guy who tested for "(1 == 0)" doesn't seem very thorough to me at all.

I mean, in some universe, this "if" could very well test false but "if (2 == 0)" might test true. What about that?

I think he should have tested all the numbers...

Why only compare to zero? Sure, (1 == 0) and (2 == 0) might both test false, but what about (2 == 1)?

What about numbers that should be equal but aren't? Like (1 != 1)? (2 != 2)?

I think we're looking at a cross product of all numbers A vs. all numbers B, testing for inequality when they're equal, and testing for equality when they're not. Only then will I be confident that we are "running in the correct Universe".

And now my head hurts.

Amateur. Maybe 1 != 0 once, but not the second or third time. So you have to test each pair an infinite number of times. And don't get me started about testing arithmetics ...

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:42 • by neminem (unregistered)
323596 in reply to 323536
Jay:
"Jewish atheists" would be something of a paradox


No, it wouldn't. "Jewish" is a rather vague term: it's a religion, a culture, and a race. You can be Jewish because your parents and their parents and their parents, etc., were all Jewish. You can be Jewish because you were raised Jewish. Or you can be Jewish because you believe in the truth of the Old Testament but not the New Testament.

See also: http://en.wikipedia.org/wiki/Jewish_atheism
http://en.wikipedia.org/wiki/Humanistic_Judaism
http://en.wikipedia.org/wiki/Secular_Jewish_culture

P.S. I believe the term is "insensitive clod".

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 16:52 • by Syntax (unregistered)
The 215 looks like a seed value for HashCode(ing) in Java (though it's obviously misnamed). We do something similar where we have a seed (to decrease collisions) and a different number which is prime *= applied to the hash of each significant field.

Joshua Bloch uses a similar technique in Effective Java.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 17:02 • by MG (unregistered)
323598 in reply to 323579
Also, since .9999.... = .9 + .09. + .009 + ..., an infinite geometric series with ratio .1 that has a finite sum.

Since the sum is the first term divided by 1 less the ratio between the terms (see Wikipedia link for proof), we get sum = .9 / (1 - .1) = .9 / .9 = 1.

QED

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 17:03 • by Maurits
323599 in reply to 323574
Crash Magnet:
Crash Magnet:
Does 0.999... = 1?

How about

F(n) = lim(10^n - 1)/10^n, n -> oo)

Take the derivitive of num & denom.

F(n) = lim(10n/10n, n -> oo)
F(n) = 1.0

QED


Actually, I just realized that the derivitive of 10^n is not 10n. But the derivitive of the num & denom would be the same anyway and you would still get the answer 1.0.



for the record:
d/dx (10^x) =
d/dx ((e^ln 10)^x) =
d/dx (e^(x ln 10)) =
by the chain rule:
e^(x ln 10) d/dx (x ln 10) =
(ln 10) (e^(x ln 10)) =
(ln 10) ((e^ln 10)^x) =
(ln 10) (10^x)

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 17:12 • by boog (unregistered)
323600 in reply to 323595
fjf:
Amateur. Maybe 1 != 0 once, but not the second or third time. So you have to test each pair an infinite number of times. And don't get me started about testing arithmetics ...

This is getting out of hand. Let's just use the following check and call it a day:
if(!universe.isCorrect())

If you really think the correctness of the universe will change during execution, feel free to extend your own universe and implement some event handling code.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 17:12 • by The Maths (unregistered)
323601 in reply to 323598
MG:
Also, since .9999.... = .9 + .09. + .009 + ..., an infinite geometric series with ratio .1 that has a finite sum.

Since the sum is the first term divided by 1 less the ratio between the terms (see Wikipedia link for proof), we get sum = .9 / (1 - .1) = .9 / .9 = 1.

QED

You seem to know quite a bit about the maths, so I'm assuming you think your silly number games are clever.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 18:00 • by Guiro (unregistered)
323602 in reply to 323514
IsAlphaNumeric = IsAlphaOrNumeric = !IsAlpha & !IsNumeric (apparently)

Therefore
!IsFunny & !IsInsightful = IsFunnyOrInsightful

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 18:12 • by Hamish (unregistered)
Haven't read all the comments, but wanted to point at that example 1 isn't much of a WTF. A particular templating engine I work with, for example, could act on an object set (iterable) that has it's own properties. In order to iterate over the object's items while in that object's template you need a reference to the object to pass to the sub template.

I might seem silly if you don't know the context, but it makes perfect sense.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 18:12 • by DaveK
323604 in reply to 323596
neminem:
Jay:
"Jewish atheists" would be something of a paradox


No, it wouldn't. "Jewish" is a rather vague term: it's a religion, a culture, and a race.
^^^ This. I was pointing out that the original post specifically stated "Judaism", which does refer to just the religion, and the reply asked who else speaks (the Jewish language) Hebrew, implying that "Jewish" and "Judaism" were synonymous. Which, as you observe, is indeed not the case.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 18:17 • by DaveK
323605 in reply to 323540
1st Century Christian:
Jay:
DaveK:
Bob:
shimon:
shimon:
Bob:

Welcome to the 21st century. News Flash: Judaism is no longer funny.

Ya see, Hebrew does not equal Judaism, you antisemitic schmuck.

Just a fix.

Really? WTF else speaks Hebrew? God?
Jewish atheists, duh.



And most first-century Christians.

Though technically you should probably say "Hebrew-speaking atheists". "Jewish atheists" would be something of a paradox, like "Buddhist Moslems". Not that people don't say it all the time.


Hey, guys. I just climbed into my time machine to post this here, since you needed a non-Jew that speaks Hebrew. Just FYI we Christians are Jews too.
No, we didn't need a non-Jew that speaks Hebrew: we needed someone who was non-Judaic who spoke Hebrew. Which you Jewish Christians quite clearly are, since you're followers of Christianity, and not followers of Judaism.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 18:53 • by Ouch! (unregistered)
323606 in reply to 323603
Hamish:
Haven't read all the comments, but wanted to point at that example 1 isn't much of a WTF. A particular templating engine I work with, for example, could act on an object set (iterable) that has it's own properties. In order to iterate over the object's items while in that object's template you need a reference to the object to pass to the sub template.

I might seem silly if you don't know the context, but it makes perfect sense.

But how do you invoke the object's getSelf() method to get a reference to the object unless you already have a reference? getSelf() is not static.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 19:15 • by stu (unregistered)
323607 in reply to 323442
Ancient Mathematician:
WthyrBendragon:
One:
Do we get to have a discussion about whether or not 1 is a prime number?


Well, it is only integer factorable to 1 and itself so, yes, 1 is prime.

However, random it is not.

Well, if you were old enough, you'd know that 1 is not even a number, so it can't be a prime.
And if you're young enough, you should know that 1 is a unit, so it can't be a prime.
Only if you're stuck some time between -200 and 1900 is 1 a prime.

Fixed focal length lenses are considered prime lenses. So if a photographer has a fixed 1mm lens, it's considered a 1mm prime lens. So 1 must be prime!

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 19:17 • by Dave (unregistered)
I had a coworker who defined these in a global include file:

#define ThereIsLifeInTheUniverse 1
#define EverAndEver ;;

(This was in C)

And then in code would do things like this...

if (ThereIsLifeInTheUniverse) ... whatever

or

for (EverAndEver) { // Hallelujah, Hallelujah!
}

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 19:19 • by Maurits
// warning: calling getSelf may make you go blind

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 19:49 • by nonpartisan
323610 in reply to 323579
Coyne:
Crash Magnet:
Does 0.999... = 1?

How about

F(n) = lim(10^n - 1)/10^n, n -> oo)

Take the derivitive of num & denom.

F(n) = lim(10n/10n, n -> oo)
F(n) = 1.0

QED


I saw this somewhere:

Given x = .999...

Then: 10x = 9.999...

Now subtract x:

10x - x = 9.999... - .999...

Complete the subtraction:

9x = 9.000...

But the endlessly repeated 0 is redundant so:

9x = 9

Factor out the 9:

x = 1

Now, substituting the original value for x:

.999... = 1

QED


IANAMathematician.

This puzzle was first given to me in high school circa 1987. I worked on it with my math teacher and, later on, with my brother because he got his degree in math.

The issues I've known to exist in this:

1. Performing a mathematical operation on an infinitely long number is undefined. You never technically reach the end multiplying by 10 because you don't know what happens at the very end of the number. The same thing can be argued for the subtraction.

2. As a value tends toward a limit in a graph, it's possible for the value that is being approached to have a discontinuity in the graph. So yes, it is *likely* that the two values are equal, but one cannot conclusively prove via graphs and limits that, indeed, the two are equal.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 19:49 • by LB (unregistered)
323611 in reply to 323549
ShatteredArm:
smxlong:
hatterson:
about whether .999... == 1
by the density of the real numbers, there must be some number X where 0.999... < X < 1.
Why does there have to be a number between the two?

Maybe there is a proof, but this is how I look at it:

What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?

And if a < b, then a != b.

Indeed there are number systems in which there is such a thing as "the largest number that is less than 1", but the only number system in widespread use in which 0.999... is a valid number is the real number system, and that one involves a continuum (the number line) rather than a series of discreet points.

Of course, if you want to posit a number system of discreet points in which there is a point for 0.999... distinct from the point for 1, you can. (There are, after all, an infinite number of possible number systems.) But you would need to define both the notation and rules for this number system yourself and identify that it's the number system you're using, since it's not one in regular use by mathematicians.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 19:51 • by Henning Makholm (unregistered)
323612 in reply to 323579
Now, substituting the original value for x:

.999... = 1

QED

Glad that's settled. Let's do the Monty Hall problem next, shal we?

You get a 13/27 probability of winning if you switch doors.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 20:01 • by Sam (unregistered)
323613 in reply to 323608
I had a coworker who defined these in a global include file:

#define ThereIsLifeInTheUniverse 1
#define EverAndEver ;;

(This was in C)

And then in code would do things like this...

if (ThereIsLifeInTheUniverse) ... whatever

or

for (EverAndEver) { // Hallelujah, Hallelujah!
}

The jokes on him! By using constant definitions like that his code will execute incorrectly when it runs on the last computer on some cold dead rock in a dying universe.

Should have included that scenario in the unit tests, or used a real constant like

#define PopeIsCatholic 1

I hadn't seen the for ever and ever one before, that's pretty good!

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 20:07 • by Kuba
323614 in reply to 323444
Anonymous Kernel Hacker:
I think certain versions of Linux have included the line

if(false)panic();

just to verify that boolean logic is operating correctly.
On any modern compiler, this would only verify things at compile time. To check if the runtime environment is sane, you'd need to have something like:

volatile static int unhunh = 0;
void sanity_check(void)
{
if (unhunh) panic();
}
I would need to check in the standard as to whether a static volatile won't be subject to optimization, but my initial gut feel is that with most compilers it would produce code that actually checks the value of unhunh in memory at runtime.

Re: ISelfAware, Very Thorough, Crazy Hashmaps, and More

2010-09-29 20:13 • by Kuba
323615 in reply to 323611
LB:
ShatteredArm:
smxlong:
hatterson:
about whether .999... == 1
by the density of the real numbers, there must be some number X where 0.999... < X < 1.
Why does there have to be a number between the two?

Maybe there is a proof, but this is how I look at it:

What is the largest number that is less than 1? I think you'd have to conclude that it is 0.999... wouldn't you?

And if a < b, then a != b.

Indeed there are number systems in which there is such a thing as "the largest number that is less than 1", but the only number system in widespread use in which 0.999... is a valid number is the real number system, and that one involves a continuum (the number line) rather than a series of discreet points.

Of course, if you want to posit a number system of discreet points in which there is a point for 0.999... distinct from the point for 1, you can. (There are, after all, an infinite number of possible number systems.) But you would need to define both the notation and rules for this number system yourself and identify that it's the number system you're using, since it's not one in regular use by mathematicians.
Oh boy. Why so convoluted, when it's all easy. We must not forget that 0.999(9) is merely a notation in decimal positional system. That notation denotes the number 1. Yes, it's perhaps weird that every real number with a finite expansion in a positional system has a second, equivalent notation that has an infinite expansion in that same system. It's a quirk, but I've heard of it in high school math class. It works in any positional system, too. In binary, you have it too: 1.0 == 0.1111111(1), or say 0.5[base 10] = 0.1[base 2] = 0.0111(1), and so on.

Remember: it's a quirk of positional representation, nothing more and nothing less. If you write 0.999(9), or using your notation 0.9999..., you are representing number 1. That's all there is to it.
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6Next »

Add Comment