## Search found 3683 matches

Wed Jun 15, 2016 7:33 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9968
Views: 1952242

### Re: Coding: Fleeting Thoughts

Incidentally, you can easily do ceiling division in Python. From http://stackoverflow.com/a/17511341/4014959

Code: Select all

`def ceildiv(a, b):    return -(-a // b)`

So -a // b * -b gives the next multiple of b >= a.
Thu Jun 09, 2016 9:46 am UTC
Topic: 1691: "Optimization"
Replies: 53
Views: 10310

### Re: 1691: "Optimization"

According to Wikiquote there are two versions of this remark about premature optimization in Knuth's writings. Knuth calls it "Hoare's Dictum", after fellow computer scientist Tony Hoare (inventor of Quicksort, etc), but that's just Knuth having a bit of fun. The real problem is that progr...
Wed Jun 01, 2016 4:16 pm UTC
Topic: 1687: "World War III+"
Replies: 34
Views: 8075

### Re: 1387: "World War III+"

@sardia

"World War III+" is actually comic #1687; comic #1387 is "Clumsy Foreshadowing".

Whatever happened to the opening post linking the thread to the comic?
Wed Jun 01, 2016 3:58 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13421
Views: 1689293

### Re: Today I Learned

TIL: When you bleach purple hair, it turns green! I am super fascinated. I Am Not A Chemist, but I suspect that the colour change is due to a change in the oxidation state of a red pigment in the purple dye. On a (possibly) related note: In high school chemistry, I discovered that nitric acid turns...
Mon May 30, 2016 11:29 am UTC
Topic: 1685 : Patch
Replies: 40
Views: 10727

### Re: 1685 : Patch

A friend of mine found a python autocomplete that evaluates your code to figure out the autocomplete, so that's kind of like compiling it? I mean I know that Python can't be compiled by definition but that the same concepts, at least. Like the vast majority of modern language implementations, all i...
Mon May 30, 2016 9:36 am UTC
Forum: Coding
Topic: Code duplication vs clarity
Replies: 15
Views: 6997

### Re: Code duplication vs clarity

Since it's first and foremost a matter of whether each piece of data is included or not, I would do an alternate version of your first suggestion using binary, like this. case = 0; if (A) case &= 1; if (B) case &= 2; if (C) case &= 4; if (D) case &= 8; if (E) case &= 16; switch ...
Tue May 17, 2016 7:36 am UTC
Forum: Language/Linguistics
Topic: Miscellaneous language questions
Replies: 590
Views: 112274

### Re: Miscellaneous language questions

"Bubbler" (with 3 syllables) was the preferred term when I was in primary school, in Sydney, Australia, several decades ago. And they were generally of the unsanitary vertical stream design. In high school, we tended to call the bubblers "the taps"; "bubbler" was a term...
Sun May 15, 2016 5:49 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9968
Views: 1952242

### Re: Coding: Fleeting Thoughts

Today I discovered the horror of bug dependencies. No, not dependency bugs, those are normal. So there was a bug report for a bug. I couldn't reproduce, but the code looked like the bug should indeed occur. I digged further and discovered three related bugs, which I fixed. Now the bug from the repo...
Fri May 13, 2016 8:53 am UTC
Topic: 1680: "Black Hole"
Replies: 31
Views: 7595

### Re: 1680: "Black Hole"

Just how small is this black hole? Assuming that black spot is supposed to be the event horizon then it looks like it has a Schwarzschild radius of a centimetre or so. That's a rather heavy object to support with a regular coffee table. :) Maybe the coffee table and stand are made from unobtainium.....
Thu May 12, 2016 11:46 am UTC
Forum: Science
Topic: How do we know what electron orbitals look like?
Replies: 8
Views: 3308

### Re: How do we know what electron orbitals look like?

This article from 2005 by David Villeneuve Orbital Imaging: Laser-generated high-harmonic radiation produces tomographic images of molecular orbitals describes how to get the shape of the wave function of a molecular electron orbital. Using a computed tomography algorithm, we converted the data to a...
Thu May 12, 2016 11:08 am UTC
Forum: Science
Topic: Which planet?
Replies: 28
Views: 5437

### Re: Which planet?

@doogly: Love your work. I feel obliged to throw in a kind word for Mercury. Caloris Planitia is a plain within a large impact basin on Mercury, informally named Caloris, about 1,550 km (960 mi) in diameter.[1] It is one of the largest impact basins in the Solar System. The plain itself is about 685...
Wed May 11, 2016 7:54 am UTC
Forum: Science
Topic: Alkaline Food
Replies: 26
Views: 7411

### Re: Alkaline Food

Lutefisk is quite alkaline: pH of 11–12, although it is soaked in water before final preparation, which reduces the pH considerably.

Also, some people use lye as a seasoning. See viewtopic.php?t=96865&p=3211809#p3183323
Sun May 08, 2016 11:54 am UTC
Forum: Mathematics
Topic: Seating problem
Replies: 6
Views: 2851

### Re: Seating problem

Here's a Python 2 / Python 3 program that finds solutions. I haven't looked at Flumble's code, but I am using lorb's optimization. My approach is to express the problem as an Exact Cover problem. Our goal is to find sets of 4 permutations so that each of the 10 people get exactly 8 neighbours over t...
Sun May 08, 2016 8:34 am UTC
Forum: Coding
Topic: [Resolved] Generalized Hamming numbers in Python
Replies: 3
Views: 4249

### Re: Generalized Hamming numbers in Python

What Xanthir said, although you really only need to worry about m . Here's my version. It creates the generator expressions using a function multiples that takes i and m as args. It would work if you only pass m as an arg, but I think it improves readability to pass them both. My code doesn't use yi...
Sat May 07, 2016 10:59 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9968
Views: 1952242

### Re: Coding: Fleeting Thoughts

I'm actually going to rewrite in C++ for the performance gains. The full program may take days to run in python. Wise. I love Python, but it's not particularly fast or conservative of RAM. FWIW, in 32 bit CPython a small Python integer (i.e., one that fits into a 32 bit signed machine integer) cons...
Fri May 06, 2016 8:08 am UTC
Forum: Fictional Science
Topic: Fiction Idea: Breaking out of the simulation
Replies: 12
Views: 9412

### Re: Fiction Idea: Breaking out of the simulation

Copper Bezel wrote:
Spoiler:
Including the matryoshka doll zinger at the end. Of course, you get that with The Thirteenth Floor and Inception and all of these things, it's basically obligatory....

Spoiler:
It's turtles virtuals all the way down.
Fri May 06, 2016 8:00 am UTC
Topic: 1676: "Full-Width Justification"
Replies: 64
Views: 18191

### Re: 1676: "Full-Width Justification"

YMMV, but personally I admire the documentation for FFTW , clearly written by people who have a mastery not only of their topic but of the English language too. It's direct without being overly informal, and has jokes and humorous footnotes that enhance readability without detracting from the clari...
Thu May 05, 2016 8:16 am UTC
Topic: 1676: "Full-Width Justification"
Replies: 64
Views: 18191

### Re: 1676: "Full-Width Justification"

My Linotype keyboarding manual talks quite a bit about justification. On a Linotype, automatic justification was achieved by adjusting the space between words with variable width spaces that would evenly divide up the space when the line was sent to cast. [...] ETAOIN SHRDLU Many years ago, I was g...
Thu May 05, 2016 7:39 am UTC
Forum: Science
Topic: Dropping a Cloud Nine From Orbit
Replies: 38
Views: 7072

### Re: Dropping a Cloud Nine From Orbit

Maybe I'm missing something here, but I don't see what the big problem is with just constructing the dome on the ground. Of course, it's not going to support its own weight when it's partly built, but why does it need to do that? It's a tensegrity structure, so you just build it flat, with plenty of...
Tue May 03, 2016 7:41 am UTC
Forum: Language/Linguistics
Topic: Miscellaneous language questions
Replies: 590
Views: 112274

### Re: Miscellaneous language questions

Spoiler:
Thu Apr 21, 2016 12:33 pm UTC
Topic: 1670: "Laws of Physics"
Replies: 46
Views: 12208

### Re: 1670: "Laws of Physics"

AFAIK, Feynman did it first. "There were 183 of us freshmen, and a bowling ball hanging from the three-story ceiling to just above the floor. Feynman walked in and, without a word, grabbed the ball and backed against the wall with the ball touching his nose. He let go, and the ball swung slowly...
Tue Apr 19, 2016 8:23 am UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13421
Views: 1689293

### Re: Today I Learned

Nice round-cut diamond. Do you have Princess and Cushion cuts too? Thanks! No, I only have variations on the Tolkowsky brilliant cut. There's an old POV-Ray include file for a brilliant cut, but I wasn't happy with it, so I made an improved version by referring to Tolkowsky's book: A Study of the R...
Mon Apr 18, 2016 8:28 am UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13421
Views: 1689293

### Re: Today I Learned

... and that the LEDs on the webcam are bright enough to cause positive phototropism: http://i300.photobucket.com/albums/nn9/Sableagle/Demolition%20Ranch%20Barrett/apple_seedlings_zpsey0x1zye.gif Now trying again with a different species, from a higher angle. Interesting! I was going to ask you why...
Mon Apr 18, 2016 8:06 am UTC
Forum: General
Topic: Origami and Mental Illness
Replies: 7
Views: 4538

### Re: Origami and Mental Illness

Impressive work, Cleverbeans! FWIW, I've folded quite a few flapping birds over the decades, but never any that tiny. (But I do have a cellophane one on my desk that I folded about 20 years ago).
Mon Apr 18, 2016 7:57 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9968
Views: 1952242

### Re: Coding: Fleeting Thoughts

Everyone knows the feeling when something that should work, doesn't. Today I got to experience the more rare feeling of something working, which shouldn't. I get uncomfortable when that happens, and if I can't prove to myself why it behaves the way it does I have to change it to something I do unde...
Mon Apr 18, 2016 7:38 am UTC
Topic: 1668: "Singularity"
Replies: 26
Views: 7729

### Re: 1668: "Singularity"

And for those who don't know who keithl is, please see Keith Lofstrom , Launch loop , and Keith Lofstrom's Vanity Web Page . wait. wait. ...uhh... ..uh..ok..Tell me. Is our Keith That Keith? ...Well,...ok. ... I'm willing to believe it... We are in the company of some very fine minds. He sure is. F...
Sat Apr 16, 2016 7:31 am UTC
Replies: 38
Views: 8360

So as far as I know, we haven't covered the initial So in this forum (no doubt it's been discussed elsewhere on the board, but...). I quite like it, actually; or at least it doesn't annoy me. It seems to me that so is used in the sense "what I'm about to say follows directly from your question...
Sat Apr 16, 2016 7:07 am UTC
Topic: 1668: "Singularity"
Replies: 26
Views: 7729

### Re: 1668: "Singularity"

Keyman wrote:So does the "l" in 'keithl' stand for Leibowitz?

Good call. For those who don't get the reference, please see A Canticle for Leibowitz.

And for those who don't know who keithl is, please see Keith Lofstrom, Launch loop, and Keith Lofstrom's Vanity Web Page.
Mon Apr 11, 2016 6:35 am UTC
Forum: Mathematics
Topic: Simplifying expressions with unit'd values
Replies: 13
Views: 3472

### Re: Simplifying expressions with unit'd values

What is the meaning of units in the denominator in this case? Can you provide an example of how this would be used and what it would translate to physically? We need ratios of lengths if we want to be able to scale things and ensure the scaled version is a similar shape ( in the sense of similar tr...
Sat Apr 09, 2016 8:40 am UTC
Forum: Mathematics
Topic: Efficient Prizims
Replies: 9
Views: 2451

### Re: Efficient Prizims

As gmalivuk said, this is easy to do if you know some calculus, but it's not too hard to verify that s=4 gives the maximum volume for the open box. To make the arithmetic simpler, I'll scale the square down by ¼, so that s=1 and the original square is 6 x 6. The base of the box has length and width ...
Tue Mar 29, 2016 12:40 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9968
Views: 1952242

### Re: Coding: Fleeting Thoughts

So there's this idea I have about tying chats/media shares like telegram, IRC and WhatsApp (using yowsup) together, but I'm unsure as to what common backend to use. The goal is to have all messages available to any networked device, though preferably messages would be loaded on demand, like a typic...
Fri Mar 11, 2016 6:25 pm UTC
Topic: 1654: "Universal Install Script"
Replies: 57
Views: 21418

### Re: 1654: "Universal Install Script"

INB4 : Hey this only works if you have a *nix shell running in the first place! Anyone else here old enough to have thought the pip install was referring to this? Anyway, "install" is where horses should be. I'm old enough to have used pip on CP/M, and I was certainly reminded of that pip...
Fri Mar 11, 2016 5:50 pm UTC
Forum: Fictional Science
Topic: New (economically) type of FTL travel
Replies: 16
Views: 9925

### Re: New (economically) type of FTL travel

I like it! Each ship has a accuracy parameter (usually between 1.5 and 4, unitless of type distance per distance). Travel between the source point and the actual destination is instantaneous. Specifically the traveler experiences zero/trivial time traveling and arrives at their destination either a ...
Mon Mar 07, 2016 7:15 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9968
Views: 1952242

### Re: Coding: Fleeting Thoughts

Jplus wrote:I have posted an answer too, which is a bit more efficient.

Nice approach, Julian. I didn't think of doing it like that, but I guess it works if the filtering algorithm accepts an iterator and doesn't need random access or multiple passes over the data.
Sun Mar 06, 2016 10:45 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9968
Views: 1952242

### Re: Coding: Fleeting Thoughts

I've been thinking about a SciPy-related problem I can't quite figure out yet. Since my post on Stack Overflow didn't get any replies and none of my friends appear to have a solution either, I figure it can't hurt to ask here as well. Sorry, I didn't even look at your question earlier, since I don'...
Wed Mar 02, 2016 11:17 am UTC
Forum: Mathematics
Topic: Math: Fleeting Thoughts
Replies: 427
Views: 147528

### Re: Math: Fleeting Thoughts

Here's a simple way to store a table of primes in a fairly compact form. All primes greater than 5 are obviously coprime to 2, 3, and 5 and hence are coprime to 2*3*5 = 30. IOW, all primes > 5 are congruent to one of (1, 7, 11, 13, 17, 19, 23, 29) mod 30. Note there are 8 numbers in that set, so we ...
Sun Feb 28, 2016 2:39 pm UTC
Forum: Mathematics
Topic: Are all the sequence numbers prime?
Replies: 4
Views: 1499

### Re: Are all the sequence numbers prime?

No. The next term in your sequence (after 510767) is 1380265110671180253634405030613336299264996365622991486305858014214261048243081794992210453163935138192156457386571249076356922837629566181477039018950513703169278191952771328537454016440857127805568317159302017023312808646477597452054638680664401...
Sun Feb 21, 2016 6:34 am UTC
Topic: 1643: "Degrees"
Replies: 147
Views: 25336

### Re: 1643: "Degrees"

Also, for what it's worth, a black hole of one Planck mass is actually 4 Planck lengths across, ... FWIW, using 2 Planck lengths as the Schwarzschild radius and the formula for I , the entropy in bits, found in the Wikipedia article on the Bekenstein bound , the entropy of that black hole is <= 4π/...
Fri Feb 19, 2016 5:15 am UTC
Topic: 1644: "Stargazing"
Replies: 40
Views: 11393

### Re: 1644: "Stargazing"

Also, does "is" imply the object's existence and status in the present tense? (So much of what we see in the sky, after all, no longer exists.) Most of the objects in our sky are within our milkyway. Those objects are, at most, about 100,000 light year away. Thus the info we have on them ...
Wed Feb 17, 2016 3:50 am UTC
Forum: Mathematics
Topic: Infinite Inscribed Squares
Replies: 10
Views: 3169

### Re: Infinite Inscribed Squares

Is that from 32 or 64 bit calculations? I'm running Python 2.6.6 on a 32 bit machine. My Python's floats are IEEE-754 doubles, so they have 53 bits of precision. The more accurate value for the area was calculated with 50 decimal digits of precision; I chopped off the last couple of digits, so the ...