HNHacker News
TopNewBestAskShowJobs

TimonKnigge

134 karma · joined June 5, 2016

submissionscomments
TimonKnigge··on The 2,500 year old history of why Python’s all([]) returns True
`all(x + y) = all(x) and all(y)` even when `x, y` can be the empty list.
TimonKnigge··on No person who was born blind has ever been diagnosed with schizophrenia
Your 'approximation' is doing a lot of the work here.. Since you have a binomial distribution why not just use it directly?

(1 - 2e-6)^(3e6) ≈ 0.002

So about 0.2%. Still highly unlikely but orders of magnitude more likely than what your normal distribution-detour gave.

TimonKnigge··on Scientists claim to find HIV virus-like insertions in the 2019-nCov [pdf]
see https://twitter.com/trvrb/status/1223337991168380928
TimonKnigge··on Click Here to Kill
Someone didn't read the article :-)

> While I was working on this story, journalists at BBC News Russia confirmed the first known case of a murder being ordered on the dark web and successfully carried out by hired assassins.

TimonKnigge··on Get Billions of Correct Digits of Pi from a Wrong Formula (1999) [pdf]
Do you mean 'approaches infinity'? Because at n=0 the expression is maximal :-)

But the point is not to drop small terms at the extremes - it is still an infinite sum. The point is to approximate sections of the function by rectangles, and those rectangles are a bad approximation around 0 too.

TimonKnigge··on ‘Overtourism’ Worries Europe. How Much Did Technology Help Get Us There?
According to this [0] calculator, $150K in 1965 is nearly exactly $12M in todays dollars (not sure how to inflation-adjust euros back into the sixties :-) ).

[0] https://www.usinflationcalculator.com/

TimonKnigge··on Why some PhDs are quitting academia for unconventional jobs
Tangentially, the author now prefers applied mathematics to economics [0].

[0] https://twitter.com/Noahpinion/status/1015988356184866817

TimonKnigge··on What It Felt Like in Hawaii When Warning of an In-Bound Missile Arrived
> surround yourself with as much building as you can (the middle floor of a high rise, or a basement three stories deep, etc.)

Why would the middle floor of a high rise be better than its ground floor?

TimonKnigge··on Amber Rudd accuses tech giants of 'sneering' at politicians
> as the point of dragnet surveillance is using competitor nations' secrets for economic advantage, not for fighting terrorism.

Source / examples? Seems like a rather extraordinary claim.

TimonKnigge··on Apple switches from Bing to Google for Siri web search on iOS and Mac Spotlight
I get no results following your link.
TimonKnigge··on Dark Matter May Be Trapped in All the Black Holes
Do they? These black holes would have masses of some multiple of ten times the mass of the sun, which doesn't seem terribly heavy (relatively). How does this explain the Fermi paradox?
TimonKnigge··on Why I left Academia: Part I
Not to stoke the fire but she's on this [1] page with Flores as advisor.

[1] http://arthistory.rutgers.edu/menu-iii/current-students/curr...

TimonKnigge··on Google Employee's Anti-Diversity Manifesto Goes 'Internally Viral'
Also preference falsification.

https://en.wikipedia.org/wiki/Preference_falsification

TimonKnigge··on Owl – An OCaml Numerical Library
Or the nocturnal bird.
TimonKnigge··on European Commission fines Google €2.42B for abusing dominance
> Fines are paid into the Community budget and therefore help to finance the European Union and reduce the tax burden on individuals.

https://twitter.com/EU_Commission/status/879647936686305281

TimonKnigge··on Multiplying and dividing with Hindu-Arabic numerals and with Roman ones
Nothing better than a bit of internet drama :)
TimonKnigge··on Multiplying and dividing with Hindu-Arabic numerals and with Roman ones
Because then 'least' is on the left, and you work from left to right, in the same way that you read from left to right.
TimonKnigge··on Multiplying and dividing with Hindu-Arabic numerals and with Roman ones
Not OP, but I guess it's easier because you work from left to right. At least, I find subtraction/addition easier to do from least to most significant digit, since the results of the less significant digits affect the more significant digits, but not the other way around.

EDIT: To be clear, going from left to right is not inherently 'easier' but it would be more consistent with our direction of writing.

TimonKnigge··on The Axiom of Choice Is Wrong (2007)
> First, the axiom of voice requires that you have a countable number of sets that you are choosing elements from, but there are undoubtably many of the equivalence classes that he described [0].

No it does not? The axiom of countable choice [0] is a strictly weaker axiom.

[0] https://en.wikipedia.org/wiki/Axiom_of_countable_choice

TimonKnigge··on Yes, organic farming will kill us all
Article 5 paragraph 2 in your link more explicitely says this as well.
TimonKnigge··on Yes, organic farming will kill us all
Sorry, but do you have a source for this? The EU only sets a maximum level (50 mg/l apparently [1]), but member states are free to set lower maximums.

[1] http://www.eea.europa.eu/data-and-maps/indicators/nitrate-in...

TimonKnigge··on Skip Lists Done Right
The pseudocode + example given for the initial implementation of 'insert' doesn't seem right, no 'below' connection is made between the two '13' nodes.

The way to fix this would be to let 'insert' return the node inserted at the given level. There already are a few returns in the 'insert' pseudocode right now, but it doesn't seem like anything is being returned right now.

Something like this:

    -- Recursive skip list insertion function.    
    define insert(elem, root, height, level):
        if right of root < elem:
            return insert(elem, right of root, height, level)
        else:
            if level = 0:
                new ← makenode elem
                old ← right of root
                right of root ← new
                right of elem ← old
                return new
            else:
                if level ≤ height:
                    new ← makenode elem
                    old ← right of root
                    right of root ← new
                    right of elem ← old
                    below new ← insert(elem, below root, height, level - 1)
                    return new
                else:
                    return insert(elem, below root, height, level - 1)
Or more simply:

    define insert(elem, root, height, level):
        if right of root < elem:
            return insert(elem, right of root, height, level)
        elif level > height:
            return insert(elem, below root, height, level - 1)
        else:
            new ← makenode elem
            old ← right of root
            right of root ← new
            right of elem ← old
            if level > 0:
                below new ← insert(elem, below root, height, level - 1)
            return new
TimonKnigge··on Apple Increases Prices of Macs in U.K. By 20 Percent
Shouldn't they raise their prices by 25% to compensate for that though?
TimonKnigge··on Google's “Director of Engineering” Hiring Test
Depending on how the pivot is picked, Quicksort can actually be implemented in O(n lg n) worst-case time.

EDIT: I was going to link a proof for this but it's surprisingly hard to find. IIRC, the idea is to use the median of medians algorithm ([1]) to pick the median for the pivot, and deal with values equal to the pivot by alternatingly placing them in the left and right partition, or alternatively just keep them in a third partition in the middle.

[1] https://en.wikipedia.org/wiki/Median_of_medians

TimonKnigge··on 2017 will be filled more votes on the EU
As someone living in the Netherlands, let me place a few sidenotes next to the section about it:

- The 88% poll appears to be conducted amongst (online) Telegraaf readers (here is an online version: http://www.telegraaf.nl/watuzegt/25920298/__Britten_moeten_i...) which is a bit comparable to the British 'Daily Mail'.. It's very anti-EU, and while it definitely has a large number of readers, the 88% is not at all representative of the Dutch population.

- The Ukraine referendum is mentioned, specifically: "The agreement itself is not that critical but the vote was widely used as a vote on the EU itself. It went against the EU by 61% to 32%, albeit on low turnout of only 32%.". The low turnout is relevant, a lot of people decided to strategically not vote in order to signal their dislike for the referendum itself. Although the minimum turnout (30%) was barely reached, the fact that this turnout was so low - combined with the fact that the anti-EU parties implicitly marketed it as an anti-EU vote - signals to me that much fewer people would vote against the EU in a referendum similar to the British one.

There is certainly a lot of anti-EU sentiment, but this article does appear to cherry pick its sources.

TimonKnigge··on Mean of two floating point numbers can be dangerous
Yes there is! Right here:

It's actually really simple. We'll write a and b in binary notation, for example:

  a = 1001101
  b = 0100111
Now what happens when you add two numbers in binary? We essentially add the numbers in each column together, and if it overflows, we carry to the next column (this is how you carry out addition in general).

So what are the columns where we need to carry, the ones that overflow? These are given by (a&b) - the columns where both a and b contain a one. To actually carry we just move everything one position to the left: ((a&b)<<1). And what are the columns where we don't need to carry, the ones that don't overflow? These are the ones where we have exactly one zero, either in a or in b, so: a^b.

In other words, a + b = ((a&b)<<1) + (a^b). To compute the average, we divide by two, or in other words, we bitshift to the right by one place: (a + b)/2 = (a&b) + ((a^b)>>1)

If anything is unclear, feel free to ask :)

TimonKnigge··on Mean of two floating point numbers can be dangerous
I like this one better: (min&max) + ((min^max) >> 1)

  #include <iostream>
  using namespace std;

  int avg(int a, int b) {
    return (a&b) + ((a^b)>>1);
  }

  int main() {
    cout << avg(int(2e9), int(2e9 + 10)) << endl;
    cout << avg(int(2e9), int(-2e9)) << endl;
    cout << avg(int(-2e9), int(-2e9 - 10)) << endl;
    
    return 0;
  }
Gives:

  2000000005
  0
  -2000000005
← PreviousPage 2 of 2