Welcome, Guest

Author Topic: Coding  (Read 181629 times)

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #570 on: January 21, 2016, 06:27:29 PM »
yes but multiply 100 by 100 or 1 by 100

they are different results

vh

  • formerly mudkipz
  • *****
  • Posts: 1138
  • "giving heat meaning"
Re: Coding
« Reply #571 on: January 21, 2016, 07:46:13 PM »
so apparently the reason my code suddenly got so fast is because i accidentally created a bug which caused the code to actually not do any computations at all but still appear to work and yeah i fixed that and now it's back to not being super fast but still being 2 to 3 times faster than it was before

1 million bodies for ten thousand timesteps should take about a day to compute now

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #572 on: January 25, 2016, 11:20:12 PM »


it's not done yet

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #573 on: January 26, 2016, 02:39:37 PM »
so anyway, i calculated musical taste groupings for the 15 eligible past participants of univision

basically what I did was, I compared the votes of every nation with every other nation, and got values for every single pairing (vote similarity + whether both nations vote for each other)

then created an algorithm which would split the nations into 4 groups which internally matched the closest, ignoring the rest of the nations

the result is 4 different musical tastes, or "pots"



if you think you're in the wrong pot, you very well may be, but you likely were sacrificed for someone else who fit better. for example, darvincia fits very well into pot C (Solea, Dotruga, and Blaland are his 1st, 2nd, and 4th most similar nations), and not very well into B (with his 6th, 8th, and 13th)

but the nation that he switched with, Bielosia, fits worse in pot B (10th, 11th, 12th), but about equally as well as Darvincia did in pot C (1st, 2nd, 5th)

this switch increased total affinity by 17 units

this doesn't exactly serve any functional purpose in univision, since we have no semifinals, but it does give a quantified sense of musical tastes and voting similarities

a more detailed chart and calculations that were used to determine this can be found here
« Last Edit: January 26, 2016, 02:52:40 PM by atomic7732 »

Darvince

  • *****
  • Posts: 1837
  • 差不多
Re: Coding
« Reply #574 on: February 02, 2016, 11:47:48 AM »
can someone check all ips on wikipedia like contributions for 174.19.xxx.xxx

FiahOwl

  • *****
  • Posts: 1234
  • This is, to give a dog and in recompense desire my dog again.
Re: Coding
« Reply #575 on: February 02, 2016, 01:45:43 PM »
that sounds like it'd take a long time

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Coding
« Reply #576 on: February 02, 2016, 02:00:26 PM »
i think it might make individual pages for each IP so it should be relatively easy.

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #577 on: February 02, 2016, 02:48:52 PM »
there are contribs pages for every IP that has edited so yes

Darvince

  • *****
  • Posts: 1837
  • 差不多
Re: Coding
« Reply #578 on: February 02, 2016, 04:48:06 PM »
fiah there's a reason i asked in the coding thread (hint hint)

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #579 on: February 15, 2016, 12:32:40 AM »
dar's number criteria thing i coded for him

even numbers not divisible by 10 whose digit sums are primes whose digit sums are prime

http://pastebin.com/dWrnN7VY

example: 14972 (even)

1+4+9+7+2 = 23 (prime)
sum again:
2+3 = 5 (prime)

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Coding
« Reply #580 on: February 15, 2016, 08:45:50 AM »
do you even loop kalassak?
#rekt
http://pastebin.com/xNVqWXcj

vh

  • formerly mudkipz
  • *****
  • Posts: 1138
  • "giving heat meaning"
Re: Coding
« Reply #581 on: February 18, 2016, 11:42:48 AM »
holyshit, i just discovered this new python built-in today

testing if all values in a list are positive:

old style:
Code: [Select]
false not in [val > 0 for val in lst]
with this built-in:
Code: [Select]
all(val > 0 for val in lst)

Bla

  • Global Moderator
  • *****
  • Posts: 1013
  • The stars died so you can live.
Re: Coding
« Reply #582 on: March 15, 2016, 06:26:12 AM »
I was working on a script that needs to fit a function, which has decided that it wants to contain an integral. I spent more than an hour trying to figure out why many variables, starting with Rg, began to change to ridiculous values after the first turn in the loop. Well, it turns out I used c for the speed of light and forgot that I also trashed a useless matrix element into a variable called 'c' in the loop. gg. Do never use c for anything else than the speed of light.


vh

  • formerly mudkipz
  • *****
  • Posts: 1138
  • "giving heat meaning"
Re: Coding
« Reply #583 on: March 15, 2016, 07:28:35 AM »
kol bad variable names have cost me many hours of debugging

also when i write physics simulations and i do something like
x_velocity += x_acceleration*t
the copy and paste it, changing x to y to update y_velocity -- but i only change some of the x's to y's and forget the rest

Bla

  • Global Moderator
  • *****
  • Posts: 1013
  • The stars died so you can live.
Re: Coding
« Reply #584 on: March 15, 2016, 07:44:58 AM »
Yes also formulas with x1 v1 a1 t1... then you write a giant formula with lots of stuff and change half the x1's to x2's but forget this one a1 that screws up everything and takes 3*10^8 hours to find

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #585 on: March 15, 2016, 03:07:32 PM »
i am a goddess

uniformly distributed points on a sphere

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Coding
« Reply #586 on: March 15, 2016, 04:14:40 PM »
dat looks like a circle

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #587 on: March 15, 2016, 05:28:29 PM »
it's a 2d projection of points on a sphere

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Coding
« Reply #588 on: March 15, 2016, 05:34:02 PM »
oh so it is like see through

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #589 on: March 15, 2016, 10:46:14 PM »
it don't work

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #590 on: March 15, 2016, 10:51:23 PM »
ok so there's obviously a problem but i made the attractive force stronger and removed the initial random velocities

and it looks more like it works... i'm going to have to fix whatever problem showed up above (they start to collect around the poles by default?)

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #591 on: March 16, 2016, 12:11:52 AM »
[00:00] <+kalassak> two particles just decide that
[00:00] <+kalassak> they shouldn't repel directly away from each other
[00:00] <+kalassak> wth
[00:01] <+kalassak> something's wrong with the fundamental math
[00:01] <+kalassak> and i have no idea where to start
[00:10] <+kalassak> i wouldn't be surprised if i just typed sin where it was supposed to be cos or vice versa

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #592 on: March 17, 2016, 04:41:46 PM »
pole collection has kicked into overdrive

i fixed the math and the particles move in the right direction now (although toward each other in this example, because that's easier to test than repulsion)

i also updated the graphics... green = near hemisphere, purple = far hemisphere

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #593 on: March 17, 2016, 05:05:30 PM »
and repulsion

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #594 on: March 17, 2016, 06:27:27 PM »
good news

sometimes two particles on opposite sides of the planet interact with each other, take similar paths, and then shoot off at high speed

i have no idea why



also i have a theory as to why things get stuck at the poles... they basically cross over or near the pole but retain their velocity numerically... so like, they might have a positive y velocity near the north pole, cross it, then still have a positive y velocity... which causes them to cross near the pole again over and over.

not really sure how to fix it, maybe i could try to calculate the final bearing for every particle and if the bearing is southerly/northerly and it wasn't before then the y velocity will be inverted
« Last Edit: March 17, 2016, 06:35:17 PM by atomic7732 »

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Coding
« Reply #595 on: March 17, 2016, 06:33:18 PM »
can u make a circle so i can c the planet thx

vh

  • formerly mudkipz
  • *****
  • Posts: 1138
  • "giving heat meaning"
Re: Coding
« Reply #596 on: March 20, 2016, 06:55:24 PM »
this was a five minute hack i put together.

ever wonder how much time you waste browsing reddit or playing minecraft? too lazy to track your habits? well this is the script for you.

it takes a screenshot of your entire screen (should work for multiple monitors too) with a 1/600 chance every second (so an image every 10 minutes on average), and saves it to a file in the same directory with the unix timestamp as filename.

at the end of the day, you should have 144 screenshots or so which you can look through quickly and get an idea of exactly how much time you wasted.

this works on windows only
requires:
PIL / Image
pywin32

vh

  • formerly mudkipz
  • *****
  • Posts: 1138
  • "giving heat meaning"
Re: Coding
« Reply #597 on: March 20, 2016, 07:01:25 PM »
random dump of the code i used to compute optimal elytra flight. the first 45 lines are pretty beautiful code, the rest is sloppy

vh

  • formerly mudkipz
  • *****
  • Posts: 1138
  • "giving heat meaning"
Re: Coding
« Reply #598 on: March 20, 2016, 07:04:41 PM »
simulation of this chaotic system, in which every point has two randomly selected target points that it wants to be equidistant to, and points cannot get too close or too far from each other

https://dl.dropboxusercontent.com/u/42218552/0test.mp4

"so what are the points trying to do?"

they're trying to go to perpendicular bisectors (which are drawn out) of their target points. this obviously makes them equidistant

"but senpai, why are the points so jittery"

well you see, having them actually move toward the bisector requires a good amount of math

"you're good at math ... right?"

i coded this on a friday night, when my brain was mush, so instead of doing the math, i just had each point make 10 random moves, compute how good each move was, and select the best move. which is why it's jittery, because it's searching for local optima and does no planning

« Last Edit: March 20, 2016, 07:16:06 PM by vh »

atomic7732

  • Global Moderator
  • *****
  • Posts: 3829
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #599 on: March 20, 2016, 08:11:11 PM »
this was a five minute hack i put together.

ever wonder how much time you waste browsing reddit or playing minecraft? too lazy to track your habits? well this is the script for you.

it takes a screenshot of your entire screen (should work for multiple monitors too) with a 1/600 chance every second (so an image every 10 minutes on average), and saves it to a file in the same directory with the unix timestamp as filename.

at the end of the day, you should have 144 screenshots or so which you can look through quickly and get an idea of exactly how much time you wasted.

this works on windows only
requires:
PIL / Image
pywin32

perfect