• 0 Posts
  • 6 Comments
Joined 3 years ago
cake
Cake day: June 26th, 2023

help-circle
  • It has to do with how you decompose problems. In the example I gave, I was trying to point out that arithmetic average, geometric average, and normalization are related problems. Consider applying this technique to something more complicated than averages: pathfinding. You could create a dozen different efficient functions, each with different considerations, but the core of the algorithm will always be the same. You can write pathfind_land(src, dest), pathfind_sea(src, dest), pathfind_air(src,dest), pathfind_sea_and_land(src,dest) etc. but it’s obviously better to write it as pathfind(src,dest, is_traversable) and select the most efficient implementation inside the function. It also allows you to use a not-optimized implementation automatically if you haven’t made an efficient implementation.


  • This is gonna make me sound crazy, but always pass functions when possible, and use case statements for how the passed-in functions are applied.

    As a simple example, imagine you want to take the average of a set of numbers. Instead of doing sum(numbers)/len(numbers), do:

    Quotient_reduce(sum, lambda x,y: x+1, numbers)

    then, inside the definition of quotient_reduce,

    Def quotient_reduce(accumulate_by, normalize_by, list):

    If accumulate_by==sum and normalize_by==(lambda x,y:x+1):

      return [some efficient implementation of average]
    

    Else:

      Return reduce(accumulate_by, list)/reduce(normalize_by, list)
    

    I know it must look insane, but it generalizes normalization, mean, geometric mean, etc, and on the outside there’s no taste of the horrible concrete implementation!

    Apologies about formatting, I’m on my phone.



  • If I am remembering correctly, getting the weekend off was primarily pushed for by progressive Christian organizations (They needed a dedicated day to go to church, along with a work-free day for the sabbath) of course, this happened prior to the heavy conservative swing that defined most religious politics of the latter half of the 20th century. Depending on your views of the church, it’s either surprising that they were the dominant progressive force of the first half of the 20th century, or surprising that they stopped being the dominant progressive force.


  • Therapist: Do you think your dives into math are a type of avoidance for difficult problems in real life?

    Me: You know what’s really interesting? I just thought of this, but recipes can be really well represented by a directed, weighted hypergraph. Each hyperedge is an action, the weights are the measurements, and so following the directed hyperedges will result in the meal the recipe is for. It more naturally captures how recipes can be non-linear than regular list based recipes!


  • Regarding what “sounds” hot, I think 100 makes more sense as the “super hot” number than 40. Although both numbers are arbitrary, 100 is less arbitrary. (Sorta. We just culturally define 100 to be an important number) Fahrenheit makes more sense if you think of it as “0 feels super cold, 100 feels super hot” although I’ll admit it’s a little strange that room temperature is 3/4s up the scale. That could be solves with a logarithmic scale, but that would probably be worse than either system.