• 3 Posts
  • 37 Comments
Joined 1 year ago
cake
Cake day: June 18th, 2023

help-circle

  • For someone starting out, I would say that a major advantage of Python over any compiled language is that you can just create a file and start writing/running code. With C++ (which I’m also a heavy user of) you need to get over the hurdle of setting up a build system, which is simple enough when you know it, but can quickly be a high bar for an absolute beginner. That’s before you start looking at things like including/linking other libraries, which in Python is done with a simple import, but where you have to set up your build system properly to get things working in C++.

    Honestly, I’m still kind of confused that the beginner course at my old university still insists on giving out a pre-written makefile and vscode config files for everyone instead of spending the first week just showing people how to actually write and compile hello world using cmake. I remember my major hurdle when leaving that course was that I knew how to write basic C++, I just had no idea how to compile and link it when I could no longer use the makefile that we were explicitly told to never touch…



  • Yes, it’s a field. Specifically, a field containing human-readable information about what is going on in adjacent fields, much like a comment. I see no issue with putting such information in a json file.

    As for “you don’t comment by putting information in variables”: In Python, your objects have the __doc__ attribute, which is specifically used for this purpose.


  • My test suite takes quite a bit of time, not because the code base is huge, but because it consists of a variety of mathematical models that should work under a range of conditions.

    This makes it very quick to write a test that’s basically “check that every pair of models gives the same output for the same conditions” or “check that re-ordering the inputs in a certain way does not change the output”.

    If you have 10 models, with three inputs that can be ordered 6 ways, you now suddenly have 60 tests that take maybe 2-3 sec each.

    Scaling up: It becomes very easy to write automated testing for a lot of stuff, so even if each individual test is relatively quick, they suddenly take 10-15 min to run total.

    The test suite now is ≈2000 unit/integration tests, and I have experienced uncovering an obscure bug because a single one of them failed.


  • This is a very “yes but still no” thing in my experience. Typically, I find that if I write “naive” C++ code, where I make no effort to optimise anything, I’ll outperform python code that I’ve spent time optimising by a factor of 10-30 (given that the code is reasonably complex, this obviously isn’t true for a simple matrix-multiplication where you can use numpy). If I spend some time on optimisation, I’ll typically be outperforming python by a factor of 50+.

    In the end, I’ve found it’s mostly about what kind of data structures you’re working with, and how you’re passing them around. If you’re primarily working with arrays of some sort and doing simple math with them, using some numpy and scipy magic can get you speeds that will beat naive C++ code. On the other hand, when you have custom data structures that you want to avoid unnecessarily copying, just rewriting the exact same code in C++ and passing things by reference can give you massive speedups.

    When I choose C++ over python, it’s not only because of speed. It’s also because I want a more explicitly typed language (which is easier to maintain), overloaded functions, and to actually know the memory layout of what I’m working with to some degree.



  • I wouldn’t go as far as calling it “mostly meaningless”, but it definitely carries an enhancement bias, in that the better players will tend to be placed on the same team, where they mutually enhance each others goal/assist stats.

    From a recruiting perspective for instance, I would assume that it would be interesting to devise a statistic to indicate how much a player improves the team they’re on, while somehow factoring out the effects of the other players.

    At the same time of course, a lot (most?) of what makes a good team is not just the skills of the individual players, but how the different players utilise each other’s strengths and cover each other’s weaknesses.


  • While this graphic is awesome, it obviously carries a bias related to what teams a player has played on, and what league they have played in. A forward playing alongside good playmakers will score much more frequently than one without them, at the same time a playmaker with a good forward will get much more assists. Also, the play-style in different leagues can often be different, with more goals scored on average in some leagues than others.

    I wonder how one could create a statistic that takes those things into account, by somehow “normalizing” the number of goals/assists a player has based on who they played with and what league they played in.

    Also, I think it’s really interesting how that graph “curves up”. It looks like there’s a kind of trend where players getting a few more assists correlates to them scoring a lot more goals, and while almost noone has more than .35 assists per 90, there are quire a few that have more than .4 goals per 90.


  • A protein is like a really long chain of simple monomers (amino acids), that you can think of as a long string of differently coloured beads. The ordering of the beads somewhat determines how the protein functions, but the major factor that determines it is how this long string is bundled up, i.e. “folded” (think of a ball of yarn).

    A DNA sequence tells us the sequence of the amino acids in a protein, but tells us nothing about how it is folded. It is of great interest to compute how a protein will fold, given its sequence, because then we can determine how and why it works like it does, and use gene-editing techniques to design proteins to do the stuff we want. This requires huge amounts of computational power, so you get the fold@home project :)

    Thanks for contributing!



  • thebestaquaman@lemmy.worldtoMemes@lemmy.mlPiracy
    link
    fedilink
    arrow-up
    23
    arrow-down
    1
    ·
    4 months ago

    A professor at my university tried that, but the students quite quickly made a huge fuss, got the principals office involved, and the universities lawyers informed said professor that what she was doing was illegal, and that she should stop before she got any more trouble. She stopped.





  • Assuming

    • cylindrical human, 2m tall, 25 cm diameter.
    • air displaced from the point you teleport to is instantly moved to form a monolayer (1 molecule thick) on your surface.
    • The displacement of air is adiabatic (no heat is transferred, which will be true if the displacement is instantaneous)

    Volume of displaced air: ≈ 100L = 0.1m^3 At atmospheric conditions: ≈ 4 mol

    Surface area of cylindrical human: ≈ 1.58 m^2 Diameter of nitrogen molecule (which is roughly the same as for an oxygen molecule) : ≈ 3 Å Volume of monolayer: ≈ 4.7e-10 m^3

    Treating the air as an ideal gas (terrible approximation for this process) gives us a post-compression pressure of ≈ 45 PPa (you read that right: Peta-pascal) or 450 Gbar, and a temperature of roughly 650 000 K.

    These conditions are definitely in the range where fusion might be possible (see: solar conditions). So to the people saying you are only “trying to science”, I would say I agree with your initial assessment.

    I’m on my phone now, but I can run the numbers using something more accurate than ideal gas when I get my computer. However, this is so extreme that I don’t really think it will change anything.

    Edit: We’ll just look at how densely packed the monolayer is. Our cylindrical person has an area of 1.58 m^2, which, assuming an optimally packed monolayer gives us about 48 micro Å^2 per particle, or an average inter-particle distance of about 3.9 milli Å. For reference, that means the average distance between molecules is about 0.1 % of the diameter of the molecules (roughly 3 Å) I think we can safely say that fusion is a possible or even likely outcome of this procedure.



  • To be fair: If you live in the south, it doesn’t make much sense, but if you live a bit further north it’s the difference between getting up when the sun is a a reasonable place, or getting up in the middle of the night (winter) or the middle of the day (summer). I want it to be light out when I’m awake, not when it’s sleeping time.

    Turns out it’s easier to adjust the clock than to say “work starts at 9 in the winter and at 8 in the summer”



  • Some languages - specifically Norwegian that I know of, don’t have separate words for “boyfriend” and “girlfriend”. In Norwegian we have the word “kjæreste” which can be directly translated to “dearest”. To me it always feels a little weird to use “boyfriend” or “girlfriend”, i guess the same could be true for other non-native english speakers.