Search found 378 matches

by Tub
Fri Jul 06, 2018 11:56 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 2016: "OEIS Submissions"
Replies: 28
Views: 1930

Re: 2016: "OEIS Submissions"

psst… use a run-length encoder first. Backreferences are just as good as run-length encoding, the limit here is that common implementations (zip/gzip/deflate etc) have a fixed bit-size for the "length" parameter. For example, a backreference in DEFLATE is at least 24 bits long but has jus...
by Tub
Wed Jul 04, 2018 11:31 pm UTC
Forum: Mathematics
Topic: Question I Stumbled Across
Replies: 1
Views: 579

Re: Question I Stumbled Across

Each step is a transformation of a 2-vector (a, b) into a new 2-vector (a+b, a). This is a simple linear transformation, so you can find a 2x2-matrix M such that M * (a, b) = (a+b, a) = T(a, b) Repeated application of a linear transformation is simply repeated multiplication T^n(a, b) = M * M * ... ...
by Tub
Sun Jun 10, 2018 9:17 am UTC
Forum: Computer Science
Topic: Help me prove (or disprove) the following problem NP-hard
Replies: 7
Views: 1845

Re: Help me prove (or disprove) the following problem NP-hard

But there is no trivial assignment at the start. If the assignment w2={j1} is tried, then no solution is possible. w1={j2, j5} w2={j1, j4} w3={j3, j6} I'm a bit short on time right now, so that's all I'm going to add. Implementing the algorithm might find us a better counter-example. This just scre...
by Tub
Sun Jun 10, 2018 12:52 am UTC
Forum: Computer Science
Topic: Help me prove (or disprove) the following problem NP-hard
Replies: 7
Views: 1845

Re: Help me prove (or disprove) the following problem NP-hard

Your reduction is invalid - you cannot "add a vertex of the worker's color"; the coloring problem starts with an entirely uncolored graph. We don't know the complexity of your variant of the coloring problem - adding constraints can both increase or decrease the complexity. Doesn't matter ...
by Tub
Mon May 28, 2018 6:48 pm UTC
Forum: Science
Topic: How much is 1e340 j of energy?
Replies: 19
Views: 1100

Re: How much is 1e340 j of energy?

(Besides, I can write "Graham's number" on the back of a postage stamp. How big could it be?) Roughly twice as big as 1e340, because I can write 1e340 on the back of that stamp twice. :roll: There is probably some plank minimum number of joules below which the concept stops making sense (...
by Tub
Wed May 23, 2018 8:53 am UTC
Forum: What If?
Topic: What-If 0157: "Earth-Moon Fire Pole"
Replies: 27
Views: 7075

Re: What-If 0157 "Earth-Moon Fire Pole"

That last image eloquently illustrates one of the problems inherent in a 2 dimensional world. The only option for the poor surface folk is to attempt to outrun the pole or find an underground bunker instead of simply stepping to the side. They can't really outrun the pole when there's an unpassable...
by Tub
Thu May 03, 2018 9:26 pm UTC
Forum: Science
Topic: Quick Burning Paper
Replies: 47
Views: 2904

Re: Quick Burning Paper

You could spell out your information will 2mm ballbearings on a huge flat floor, like a warehouse. Men in Black come calling? Just tilt the floor by a degree or two. a suspicious pattern of dust-free spots emerges on the floor. You really need to turn that warehouse upside-down and shake it a coupl...
by Tub
Thu May 03, 2018 12:30 pm UTC
Forum: Coding
Topic: In search of a good build system for C++
Replies: 5
Views: 1101

Re: In search of a good build system for C++

If your build system is as simple as "compile every single file in this directory into an executable", then a simple Makefile will do. See here, for example . This has minimal dependencies, but isn't easily portable to toolchains that don't use gcc/clang's command line syntax. For example,...
by Tub
Thu May 03, 2018 10:34 am UTC
Forum: Science
Topic: Quick Burning Paper
Replies: 47
Views: 2904

Re: Quick Burning Paper

Technically , nothing a person does can actually destroy information due to the Laws of Thermodynamics. Being true to the comic, everything following "Technically" is complete nonsense. As far as I know, you still cant beat one-time-pads for secure encryption. All asymmetrical cyphers rel...
by Tub
Wed May 02, 2018 2:23 pm UTC
Forum: Science
Topic: Quick Burning Paper
Replies: 47
Views: 2904

Re: Quick Burning Paper

I think that any cryptographic approach to secrecy is going to be vastly superior to an option where you have to be physically present to set something on fire. It's probably superior against most attacks, but it has a downside: encryption does not destroy information. If a spy runs off with an enc...
by Tub
Sun Apr 29, 2018 5:00 pm UTC
Forum: The Help Desk
Topic: Compressing video and photo or I lose my job
Replies: 7
Views: 1146

Re: Compressing video and photo or I lose my job

Most video or audio formats are already compressed. Applying a lossless compression algorithm (like zip or rar) won't do anything, as you've seen.

If you need them to be smaller, you need to re-encode them with a different lossy method, but that's going to degrade quality.
by Tub
Wed Apr 25, 2018 4:06 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 608
Views: 76034

Re: Science-based what-if questions

If such a black hole were to instantly evaporate into radiation, that would be equivalent to 100 earth-sized balls of TNT going off. "Fortunately", such a black hole would actually take 2.7e24 years to evaporate. True if gradual evaporation via hawking radiation is the only relevant effec...
by Tub
Tue Apr 24, 2018 2:09 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 608
Views: 76034

Re: Science-based what-if questions

There are several lower bounds for black hole size. The uncertainty principle says that you cannot confine mass in an arbitrarily small volume, so any black hole's size (schwarzschild radius) cannot be smaller than the planck length (which is tiny), but such a black hole would have a mass of planck ...
by Tub
Mon Apr 23, 2018 6:26 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 608
Views: 76034

Re: Science-based what-if questions

If Gardevoir is capable of conjuring objects inside his crank case, it really wouldnt have to be a black hole to wreck his day. How about just a modest sized iron canonball? How about 1kg of glitter in the driver's compartment? Bigger takes longer, and an earth-radius black hole would require almos...
by Tub
Mon Apr 23, 2018 10:23 am UTC
Forum: Computer Science
Topic: Analysis of the Java RNG
Replies: 4
Views: 968

Re: Analysis of the Java RNG

There's plenty of research about Linear Congruential Generators, if you feel like diving in. They have a few weaknesses, but AFAIK none that would help you here. The state of the RNG has 48 bits, thus only 2^48 of the possible 2^64 different longs can ever be returned by nextLong. According to the d...
by Tub
Wed Apr 18, 2018 8:34 am UTC
Forum: Computer Science
Topic: What to learn to be able to make some money?
Replies: 18
Views: 2598

Re: What to learn to be able to make some money?

WanderingLinguist wrote:[...]

Thank you for your insights, that was helpful.

(My phone is for phone calls, alarm clock, notes and a web browser. I'm totally out of the loop with the app market.)
by Tub
Tue Apr 17, 2018 9:50 am UTC
Forum: Computer Science
Topic: What to learn to be able to make some money?
Replies: 18
Views: 2598

Re: What to learn to be able to make some money?

Speaking for my part of the industry (keep in mind, this is not general advice): Mobile app development is big these days, and there's a shortage of programmers who can go beyond the simple "static" mobile app that just duplicates a web site. If I may pop in for a quick question, what's y...
by Tub
Thu Apr 05, 2018 8:49 am UTC
Forum: Computer Science
Topic: What to learn to be able to make some money?
Replies: 18
Views: 2598

Re: What to learn to be able to make some money?

What Yakk said isn't entirely wrong, but only a small part of all software development is meant to produce software sold to customers. Most software development is meant to solve some internal business need - automating processes, monitoring work results, data mining, totally boring business databas...
by Tub
Wed Apr 04, 2018 12:20 am UTC
Forum: Coding
Topic: An amateur has tried to build a website in raw HTML
Replies: 54
Views: 6617

Re: An amateur has tried to build a website in raw HTML

Warning, strong opinions about jQuery ahead. I did use jQuery a lot back in the day, when it had its uses. But believe it or not, for a couple of years I've been programming without ever thinking "This problem would be easier to solve with jQuery." I haven't had much issues with br...
by Tub
Tue Apr 03, 2018 2:44 pm UTC
Forum: Computer Science
Topic: What to learn to be able to make some money?
Replies: 18
Views: 2598

Re: What to learn to be able to make some money?

The first thing you should learn is to write code and comments in english. Always. If you want feedback from others, then english is the one language that everyone in the tech world understands. You also need to get rid of the Allman brace style. As much as I love that style, there are some unfortun...
by Tub
Tue Apr 03, 2018 1:19 pm UTC
Forum: Coding
Topic: An amateur has tried to build a website in raw HTML
Replies: 54
Views: 6617

Re: An amateur has tried to build a website in raw HTML

I have a suggestion which is not directly "easy to program" because you have to learn some new things first, but: in the long term, you can make programming (in JavaScript) easier for yourself by using some libraries. You could start with jQuery and Lodash . jQuery is largely obsolete (un...
by Tub
Sat Mar 31, 2018 6:35 pm UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 608
Views: 76034

Re: Science-based what-if questions

A dark matter black hole may or may not be a tiny bit darker than a regular black hole :roll: Seriously, if you put heavy stuff within a region smaller than its schwarzschild radius, then you'll get a black hole. Dark matter has mass, so it'll work. From the outside, it won't look any different - al...
by Tub
Tue Mar 27, 2018 1:09 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1732956

Re: Coding: Fleeting Thoughts

There's extensive documentation about the calculation and interpretation of those values. I bet you haven't produced a single UML diagram, barely did any testing, and there's zero documentation, so your 700 loc aren't finished yet. Sloccount is also highly inaccurate in small projects. Writing the f...
by Tub
Fri Mar 23, 2018 9:24 am UTC
Forum: Science
Topic: Quantum Question
Replies: 110
Views: 11018

Re: Quantum Question

Assuming determinism and no cp-violations, time reversal gets you back to exactly the previous state, not to a different random low-entropy state. In a hypothetical classical world, time reversal means turning those particles around by negating all velocities. In a quantum world, time reversal is a ...
by Tub
Thu Mar 22, 2018 1:46 pm UTC
Forum: Science
Topic: Quantum Question
Replies: 110
Views: 11018

Re: Quantum Question

If you understand the state of the universe as the whole wave function, then its temporal evolution is deterministic (see: Schrödinger equation ) and it is time reversible. Randomness only appears when you try to force said wave function into a classical notion of particles with fixed positions and ...
by Tub
Thu Mar 22, 2018 10:34 am UTC
Forum: Science
Topic: Quantum Question
Replies: 110
Views: 11018

Re: Quantum Question

it implies that there are just as many possible states of the universe that, left to their own devices, would tend toward lower entropy, as there are possible states of the universe that tend toward higher entropy. If you pick a random configuration with a given low entropy, then you'll find that b...
by Tub
Fri Mar 09, 2018 8:13 am UTC
Forum: Science
Topic: Science-based what-if questions
Replies: 608
Views: 76034

Re: Science-based what-if questions

You cannot have a single giant particle in this universe. You cannot push multiple matter particles together as close as you like, either. The closest you can compress matter (without converting it into something else) is what you'll find in a neutron star. So for some fun with actual science, I rec...
by Tub
Mon Mar 05, 2018 10:34 pm UTC
Forum: Mathematics
Topic: My take on Godel's incompleteness theorems
Replies: 42
Views: 5351

Re: My take on Godel's incompleteness theorems

Is what is true/truth with mathematicians not necessarily true/truth in the empirical world of non-mathematician mankind? In a mathematical formal system, you start with a set of axioms, and you try to figure out everything that follows from those axioms. An axiom is just a premise, something that ...
by Tub
Wed Feb 28, 2018 2:01 pm UTC
Forum: The Help Desk
Topic: Mac hard disk corruption
Replies: 1
Views: 1095

Re: Mac hard disk corruption

Even booting from the corrupt drive will cause further writes to the drive. If that drive contains the only copies of important files, I'd avoid that. See if you can get your time machine working before you touch the corrupt mac again. If the time machine is lost, the first step would be to make a c...
by Tub
Tue Feb 27, 2018 8:11 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1960: "Code Golf"
Replies: 25
Views: 3795

Re: 1960: "Code Golf"

The convention should've been "don't write a language where..." Unfortunately, end-user-programmers don't get to design their own language[...] End users can choose to enable compiler flags that turn accidental assignments into warnings or errors. For scripting languages, the same can be ...
by Tub
Sun Feb 25, 2018 5:53 pm UTC
Forum: Fictional Science
Topic: Magitech society needs a heat engine
Replies: 41
Views: 4499

Re: Magitech society needs a heat engine

Hm. Is a high heat capacity a good thing? I thought a lower heat capacity means less energy is required to generate a particular temperature difference? The carnot efficiency is independent of the working fluid. Lower heat capacity just means that you need a larger volume to transform the same amou...
by Tub
Fri Feb 23, 2018 5:17 pm UTC
Forum: Fictional Science
Topic: Magitech society needs a heat engine
Replies: 41
Views: 4499

Re: Magitech society needs a heat engine

A heat engine requires neither combustion nor vaporization. It requires a hot end, a cold end and a working substance in between. Taking any real-world heat engine and replacing coal fire with a magic spell should be straightforward. Look at engines or power plants developed by humanity when we had ...
by Tub
Wed Feb 21, 2018 10:39 pm UTC
Forum: Fictional Science
Topic: Airlock full of water exposed to vacuum
Replies: 10
Views: 1918

Re: Airlock full of water exposed to vacuum

Haven't seen the movie (not that popular, apparently), but here's the phase diagram of water: https://upload.wikimedia.org/wikipedia/commons/0/08/Phase_diagram_of_water.svg There are plenty of youtube videos of water in a vacuum chamber, and in many of them the water will boil violently for a while,...
by Tub
Tue Feb 20, 2018 12:53 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1957: "2018 CVE List"
Replies: 36
Views: 4950

Re: 1957: "2018 CVE List"

I'm glad the pedants decided to step forward. Now go start working on that list!
by Tub
Tue Feb 20, 2018 8:29 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1957: "2018 CVE List"
Replies: 36
Views: 4950

Re: 1957: "2018 CVE List"

Still, I contend that in analysis of algorithmic complexity, the n is usually the length of the input , so n is already the log of the input value, i.e. the prime itself. On that basis, by your argument, the algorithm for factorising a known prime would be O(n). I usually expect to read O(b) if we'...
by Tub
Mon Feb 19, 2018 2:03 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1957: "2018 CVE List"
Replies: 36
Views: 4950

Re: 1957: "2018 CVE List"

orthogon wrote:You can factorise primes in O(1) if you know they're primes. Non-primes are trickier to factorise.

Well, a prime number n has O(log(n)) bits. If numpy makes a copy somewhere, then the algorithm is O(log(n)) as stated in the comic.
by Tub
Wed Feb 07, 2018 8:05 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1732956

Re: Coding: Fleeting Thoughts

Yeah, that's the idea. a is no longer a local variable, but a a global variable, i.e. property of the global object. Properties can have getters! Getting the global object in a compatible way is tricky, but possible: call a function without a context, then it'll use the global object as 'this'. Exce...
by Tub
Wed Feb 07, 2018 9:36 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1732956

Re: Coding: Fleeting Thoughts

Points to hotaru for this one. When comparing an object to a native value, javascript will first try to "unbox" the object, which is why new Boolean(false) == false and 42 == [42]. Unboxing may also include calling valueOf() or toString(). But you don't need unboxing. You don't need 'a' to...
by Tub
Tue Feb 06, 2018 10:46 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1732956

Re: Coding: Fleeting Thoughts

I'd say that Flumble got it, but there's something wrong with that list. For example: > 2: ["0", false, [1]] b == c doesn't hold, because false == [1] is false. There are other examples involving [1] that appear wrong. The gist however is that type coercion in JavaScript is weird , and Flu...
by Tub
Tue Feb 06, 2018 12:13 pm UTC
Forum: Science
Topic: Expansion in the long... (very) long term
Replies: 9
Views: 1799

Re: Expansion in the long... (very) long term

If space keeps expanding then yes, our "local bubble" will get smaller and smaller until eventually it only contains the milky way, and then eventually only the solar system...but it doesnt stop. If the future of our universe contains a big rip, then it'll be very far in the future, based...

Go to advanced search