egg|nomz|egg changed the topic of #kspacademia to: https://gist.github.com/pdn4kd/164b9b85435d87afbec0c3a7e69d3e6d | Dogs are cats. Spiders are cat interferometers. | Космизм сегодня! | Document well, for tomorrow you may get mauled by a ネコバス. | <UmbralRaptor> egg|nomz|egg: generally if your eyes are dewing over, that's not the weather. | <ferram4> I shall beat my problems to death with an engineer.
<SilverFox>
I need the best perf I can get, since this is a lot of numbers to crunch through
<awang>
Microoptimizing code really only comes into play once you have the right algorithm
<awang>
You can optimize a sort() function all you want, but if you use bubblesort you're not going to be going fast
<awang>
(for large sortees, anyways)
<soundnfury>
SilverFox: I'm trying to write a sane version for you now
<SilverFox>
thank you~
<soundnfury>
despite not being 100% fluent in C# (I'm all about the C, man)
<awang>
s/C/Rust
<Qboid>
awang meant to say: You Rustan optimize a sort() function all you want, but if you use bubblesort you're not going to be going fast
<awang>
........
<awang>
Another possibility is to not bother with strings in the first place
<SilverFox>
but my goal, to double check; I need to check if single digit is greater than Num, if it is, I increment the next/previous value by 1, and then check that value to make sure it isn't greater than Num, repeat process recursively
<awang>
Allocate a byte[], do math on that
<awang>
Same amount of space taken, but no converting back and forth
<soundnfury>
awang: it'd be much nicer if it could operate on arrays
<SilverFox>
interesting
<soundnfury>
also if it could be an in-place operation on currentEnum rather than having to allocate a new String to return :/
<awang>
C# doesn't overload operator[] for strings?
<SilverFox>
soundnfury, that'd be great
<egg|phone|egg>
Or if we knew what you're trying to do so that this function may cease to be needed
<awang>
ref String currentEnum?
<awang>
^algorithmic changes first plz
<awang>
egg|phone|egg: IIRC it's something about finding superpermutations
<awang>
strings containing every permutation of the numbers [1:n]
<SilverFox>
brute force, but excluding numbers that are obviously not going to be it
<egg|phone|egg>
...
<SilverFox>
such as anything greater than 4 not being in the sequence
<egg|phone|egg>
Yeah forget micro optimisation
<soundnfury>
SilverFox: oh btw I'm fairly certain your ternary hell has a bug, where you do (char)(bar + 1) that does not do what I think you think it does
<awang>
SilverFox: I think you'd be surprised how fast brute force brows
<SilverFox>
that ternary could totes be fucked
<awang>
s/brows/grows
<Qboid>
awang meant to say: SilverFox: I think you'd be surprised how fast brute force grows
<awang>
SilverFox: That's why you write clear code first!
<SilverFox>
I know how fast it grows
<soundnfury>
(char)(4) is not '4', it is ASCII character 4
<SilverFox>
it'll take 10^874 years to brute force the superperm of 6
<SilverFox>
wait what
<egg|phone|egg>
Well yes
<egg|phone|egg>
!u u+4
<Qboid>
U+0004 (␄)
<SilverFox>
why would it not be the character form of '4'?
<SilverFox>
that's just stupid
<awang>
SilverFox: Because it isn't Javascript
<awang>
Or PHP
<egg|phone|egg>
Because it's eot
<awang>
Or any other language that tries to be "helpful"
<SilverFox>
so how do i convert number to character?
<awang>
'a' + <offset>
<egg|phone|egg>
Can you start asking yourself why
<egg|phone|egg>
Rather than how
<egg|phone|egg>
Why characters
<SilverFox>
I want N length superperm capabilities
<SilverFox>
so I need to work with strings because uint64.MaxLength will get easily suprassed
<SilverFox>
Convert.ToChar() would be nce
<awang>
SilverFox: What makes you think strings will work when uint64.MaxLength won't?
<egg|phone|egg>
And strings are magic?
<SilverFox>
because a string could be longer than the length of uint64.MaxLength() right?
<egg|phone|egg>
....
<soundnfury>
egg|phone|egg: I think what he really wants is bignums, or possibly vectors of digits
<awang>
soundnfury: y u declare int i separate from the loop
<soundnfury>
but he is Doing Everything Wrong
<SilverFox>
the number sequences get really big really fast, i want to be able to handle that
<soundnfury>
awang: because kernel dev uses C89-ish and I've gotten out of that habit
<soundnfury>
SilverFox: uhh, you do know that O(bad) will completely swamp any gains from optimisation, right?
<egg|phone|egg>
I think he is trying to avoid thinking about how to approach the problem, so optimises brute force in pointless ways
<awang>
SilverFox: You're going to run out of memory before you get anywhere interesting
<SilverFox>
egg, I haven't though about the problem to begin wiht
<awang>
2^63 is *big*
<awang>
!wa 2^64 - 1
<Qboid>
awang: 2^64 - 1 = 18446744073709551615
<SilverFox>
my current working method was brute force, so making it better makes sense
<egg|phone|egg>
I ought to sleep, this discussion can serve no further purpose
<awang>
!wa bytes 2^64 - 1 to gigabytes
<Qboid>
awang: convert byte×2^64 - 1 to gigabytes: bytes - 1 and GB (gigabytes) are not compatible.
<awang>
!wa (2^64 - 1) bytes to gigabytes
<soundnfury>
like, even with just O(n!), there is basically no difference between a hyperoptimised assembly routine and a wheezing overweight man carrying rocks around in XKCD's desert.
<awang>
I guess I read "don't know superperm of 6" as "don't know *a* superperm of 6"
<SilverFox>
we know like, 3? superperms of 6, but we don't know the lowest one
<egg|phone|egg>
Put a dot
<egg|phone|egg>
!Wa log(2.)
<Qboid>
egg|phone|egg: log(2.) = 0.693147...
<soundnfury>
anyway, 872 log₁₀(6) is about 678.
<SilverFox>
we know one of amazing length, one of 874 length, one of 873 length, and that's it I think
<awang>
SilverFox: That paper has references
<SilverFox>
okay?
<awang>
And says that the superperm of 6 may be possible with a few weeks/months of CPU time
<awang>
With algorithms in those references
<SilverFox>
interesting
<awang>
So I'd say read through those references first and see if you can come up with anything better
<soundnfury>
Meaning that brute-forcing it would require searching about 10^678 combinations (that's how many 872-digit strings with only digits 1 to 6 there are)
<awang>
Unless you're fine with waiting for a while
<SilverFox>
although that doesn't mean I'll have the brains to decipher those algorithms
<awang>
Then why would brute forcing be any better?
<SilverFox>
what?
<awang>
If it takes a few weeks or months with a good algorithm, I don't want to know how long brute forcing would take
<SilverFox>
I know how to brute force, you just i++
<SilverFox>
10^874 years
<awang>
Actually, I do, but either way it isn't going to be very feasible
<egg|phone|egg>
And then you die
<SilverFox>
is how long brute forcing without optimization would take
<egg|phone|egg>
And then the sun turns into a giant
<awang>
The sun would be long past its giant phase by then
<awang>
SilverFox: Read the paper I linked
<soundnfury>
egg|phone|egg: "increment i / until you die / sun says 'bye bye' / entropy high"
<SilverFox>
awang, I'm too drunk
<egg|phone|egg>
And at that point your program ceases to run and take at its task
<awang>
It explains more of the theory behind the problem
<awang>
And what it reduces to
<soundnfury>
SilverFox: then you're definitely too drunk to find the smallest superperm of 6.
<soundnfury>
So put down the compiler and step away.
<egg|phone|egg>
S,take,fails,
<awang>
SilverFox: "We have not found an exact solution to the six-symbol instance -- Concorde failed with an internal error after running for several days"
<awang>
That was with an Amazon EC2 m3.medium instance
<awang>
I think
<SilverFox>
I have no idea what that means
<awang>
Basically a known fast-ish algorithm will take many days to find a proveably-minimal superpermutation of 6
<SilverFox>
so?
<awang>
So that's your best bet for a start
<SilverFox>
I'll run it
<SilverFox>
if I can find it, I'll do it
<awang>
So read the paper
<awang>
Stop trying to brute force it
<SilverFox>
I have an 8 core 16 thread ryzen 1700 I can dedicate to the task
<soundnfury>
SilverFox: yeahno
<awang>
If you want to prove you have the smallest superpermutation using brute force, you must try EVERY combination
<awang>
So no, brute forcing is out of the question
<soundnfury>
You're still not getting this 'big bad big-O' thing.
<SilverFox>
every combo except the ones with higher num in them than 6]
<UmbralRaptor>
Also, why is ☽🦊 like this? Picking problems that are easily shown to be impractical from a compute standpoint, like the occasional KSP n00b who refuses to acknowledge the rocket equation? >_<
<soundnfury>
UmbralRaptor: some people are just broken I guess
<bofh>
☽ being?
<UmbralRaptor>
Alchemical symbol for silver.
egg|phone|egg has quit [Ping timeout: 186 seconds]
egg|phone|egg has joined #kspacademia
e_14159 has quit [Ping timeout: 198 seconds]
e_14159 has joined #kspacademia
<awang>
!u ☽🦊
<Qboid>
U+263D FIRST QUARTER MOON (☽)
<Qboid>
U+1F98A FOX FACE (🦊)
<bofh>
UmbralRaptor: okay, sure.
<bofh>
but the way you phrased that sentence makes it sound as if ☽ is referring a person, not a chemical element.
<bofh>
Completely unrelated, I *love* 🜎
<awang>
!u 🜎
<Qboid>
U+1F70E ALCHEMICAL SYMBOL FOR PHILOSOPHERS SULFUR (🜎)
<kmath>
<hondanhon> all modern steel produced after the atomic bomb tests of the 1940s and 50s is contaminated with radionuclides https://t.co/XSoBcxCYro
<soundnfury>
that's why certain things get made from steel salvaged from pre-1945 shipwrecks
<soundnfury>
conveniently, there was a war with lots of submarines sinking shipping _juuuust_ beforehand ;)
egg|cell|egg has joined #kspacademia
egg|phone|egg has quit [Read error: Connection reset by peer]
<e_14159>
egg|cell|egg/bofh: There's a browser addon replacing Deep Learning with Derp Learning.
<rqou>
hi folks, i'm back with _more_ math help requests
<rqou>
i'm trying to find a function E(x, y) such that dE(x,y)/dx*((a-by)x) + dE(x,y)/dy*((cx-d)y)=0
<rqou>
the hint i was given was to consider a separable E(x,y)=F(x)+G(y)
<rqou>
but no matter what i try i can't find anything that satisfies the requirements
<kmath>
<AscendingNode> @AstrogatorJohn @rocketrepreneur @Astrogator_Mike Yeah, the typical approach is to make a large number of slightly… https://t.co/VHgGXPywqs
<UmbralRaptor>
rqou: uh, I don't know a good way to describe it, but treating a-by as related to dE/dy helps.
<UmbralRaptor>
Also, I shouldn't solve things in pen.
<rqou>
so apparently i was on the right track but was missing the critical trick of getting both pieces to completely just cancel each other
<UmbralRaptor>
Lots of messing around, but yeah. reverse engineering the derivatives from the extra stuff thru weft multiplied by.
<UmbralRaptor>
*they were
* UmbralRaptor
🔪 📱
<rqou>
also, i assume it's now pretty obvious what math i'm studying? :P
<UmbralRaptor>
Diff Eq?
<rqou>
not quite :P
<rqou>
look more carefully :P
<rqou>
yes, there are diff eqs involved
<rqou>
but it's more specific than that
<rqou>
arrgh goddammit i actually missed another part of the hint in the problem
<rqou>
which actually makes it a lot more obvious that this is indeed the correct solution
<UmbralRaptor>
?
<rqou>
the problem gave a hint that the function has a minimum at (d/c, a/b)
<rqou>
anyways, apparently i didn't think linear systems theory was hard enough so now i'm taking nonlinear systems theory
<rqou>
so far it feels much less satisfying
<UmbralRaptor>
nonlinear systems are evil by default?
<rqou>
yeah
egg|cell|egg has quit [Read error: Connection reset by peer]
egg|phone|egg has joined #kspacademia
<egg|phone|egg>
UmbralRaptor: kozai!
<egg|phone|egg>
UmbralRaptor: well, ballpoint pens are uncomfortable, so you should solve things with fountain pens
egg|phone|egg has quit [Read error: -0x1: UNKNOWN ERROR CODE (0001)]
egg|phone|egg has joined #kspacademia
egg|cell|egg has joined #kspacademia
egg|phone|egg has quit [Read error: Connection reset by peer]
egg|phone|egg has joined #kspacademia
egg|cell|egg has quit [Read error: -0x1: UNKNOWN ERROR CODE (0001)]
egg|cell|egg has joined #kspacademia
egg|phone|egg has quit [Ping timeout: 198 seconds]
egg|phone|egg has joined #kspacademia
egg|cell|egg has quit [Read error: -0x1: UNKNOWN ERROR CODE (0001)]
egg|cell|egg has joined #kspacademia
egg|phone|egg has quit [Ping timeout: 383 seconds]
icefire has joined #kspacademia
tawny has quit [Ping timeout: 186 seconds]
icefire has quit [Quit: Leaving]
APlayer has joined #kspacademia
BPlayer has joined #kspacademia
APlayer has quit [Read error: Connection reset by peer]
icefire has joined #kspacademia
BPlayer has quit [Ping timeout: 383 seconds]
tawny has joined #kspacademia
<SilverFox>
so apparently I was in here drunk-coding brute force methods for superpermutations?
<SilverFox>
I woke up and found a bunch of code on my laptop
<soundnfury>
We told you not to.
<soundnfury>
We said you wouldn't like it.
<SilverFox>
Nice
<SilverFox>
why did I go through all this when I can just fuckin do the thing, but backwards?
<SilverFox>
just take currentEnum and for loop it backwards
<SilverFox>
I love this ternary tho, makes me wet
<SilverFox>
where is stupid_chris? I need to send him this brilliant ternary
<UmbralRaptor>
;seen stupid_chris
<kmath>
UmbralRaptor: stupid_chris (~stupid_ch@modemcable123.158-177-173.mc.videotron.ca) was last seen joining in #kspofficial 98 days, 11 hours and 22 minutes ago
<UmbralRaptor>
!seen stupid_chris
<Qboid>
UmbralRaptor: I haven't seen the user stupid_chris yet.
<UmbralRaptor>
!wpn
* Qboid
gives UmbralRaptor a long long cezve-like clutter
<SilverFox>
where was this paper you guys spoke of that had a decent algorithm to it?
<SilverFox>
i suspect it might not be that different from what I'm doing to generate the prefix
<SilverFox>
but isn't the superperm of 6 special because it is 1 less than the estimated length by algorithm?
awang has joined #kspacademia
<SilverFox>
shit gets cray anyways
icefire has quit [Quit: Leaving]
BPlayer has joined #kspacademia
awang has quit [Ping timeout: 186 seconds]
<UmbralRaptor>
Not very familiar with superperms.
BPlayer is now known as APlayer
<SilverFox>
you take a number, take all the numbers before it above 0, then make all the permutations of that number, then try and make the smallest number that contains all those permutations, including overlapping
<SilverFox>
121 is the superperm of 2 I think, as it contains both 12 and 21
<APlayer>
And how are superperms relevant to anything?
<SilverFox>
i dont think they are
<SilverFox>
they just exist
awang has joined #kspacademia
<awang>
APlayer: Apparently finding the shortest superpermutation can be reduced to the traveling saleman problem
<awang>
So I guess finding a polynomial time algorithm for shortest permutation means you solved P=NP?
<APlayer>
I see
<awang>
idk if that's completely right
<awang>
The paper UmbralRaptor linked found the shortest known superpermutation of 6 by changing it into a TSP problem
<APlayer>
Is that the computer scientist's alternative to "I have time to waste, let's go and solve some sudokus, I guess?" :P
<awang>
idk if it means that shortest superpermutation is directly transformable into shortest TSP
<awang>
APlayer: For small values of "time to waste", yes :P
<awang>
SilverFox: The linked paper is doing something *very* different from what you're doing
<awang>
It does say there is a trivial algorithm to generate some superpermutation
<awang>
But it's definitely not the shortest
<SilverFox>
brute forcing would be the most accurate way to get the shortest, but the sacrifice there is speed
<SilverFox>
unless a proven algorithm comes out, as that one linked isn't for certain the shortest right?
<awang>
SilverFox: The simple algorithm there is known to not be the shortest
<awang>
It's just known as a way to get a superpermutation
<awang>
The Concorde solver mentioned there apparently can give you provably shortest solutions
<awang>
So it's strictly better than brute forcing
<awang>
Unless complexity is an issue
<SilverFox>
depends on what you mean by complexity
<APlayer>
Well, could you not just create a sequence (unordered) of all permutations, and move them around while crossing out overlappings via SA or something similar?
<awang>
APlayer: That's approximately what the simple algorithm in the paper does
<APlayer>
Would not guarantee the shortest solution, but good enough for me
<awang>
Yep
<APlayer>
Also, genetic alorithms
<APlayer>
algorithms*
<awang>
idk much about those
<APlayer>
Basically, a fancier alternative to SA
<awang>
SA?
<APlayer>
Simulated Annealing
<UmbralRaptor>
[D-Wave marketing intensifies]
<awang>
Oh jeez... There are at least π(k = 1 to n - 4) ((n - k - 2)!^(k * (k!)) distinct superpermutations on n for length of sum(k = 1 to n) k!
<awang>
So definitely not unique
<awang>
!acr -add:SA Simulated Annealing
<Qboid>
awang: I added the explanation for this acronym.
<APlayer>
egg: So, let's say I've implemented RKF45. I have the Y and Y* state vectors of 5th and 4th order respectively. So how do I get an error estimate out of that and how do I handle it?
<UmbralRaptor>
X: Do not model the DJIA as a quantum simple harmonic oscillator.
* awang
🔪 vague specs
<awang>
egg|work|egg: How much do you depend on C++ return type deduction instead of writing horrible type signatures?
<awang>
(if at all)
icefire has joined #kspacademia
egg|phone|egg has joined #kspacademia
tawny has joined #kspacademia
<egg|phone|egg>
Awang : what do you mean?
<awang>
auto fun(in_type it) { ... } vs auto fun(in_type it) -> std::vector<typename std::iterator_traits<decltype(std::cbegin(it))>::value_type>
<awang>
Or something along those lines
<awang>
You don't get as explicit type checking, but you don't have template barf all over your source code
<awang>
The main thing that I'm worried about is that I usually try to keep types in signatures
<awang>
But it's so... ugly
<egg|phone|egg>
Uh our functions are never auto
<egg|phone|egg>
We use deduction for llamas
<egg|phone|egg>
Um
<egg|phone|egg>
Λs
<awang>
llama calculus?
<bofh>
rofl
<egg|phone|egg>
Eggsactly
<awang>
Yeah, deduction for lambdas is much more common
<awang>
Wondering what other codebases were going for named functions
<APlayer>
Hehe
<egg|phone|egg>
Meow
<UmbralRaptor>
llama cactus?
<UmbralRaptor>
rewrite winamp in Haskell?
<awang>
UmbralRaptor: You mean Rust?
APlayer has quit [Ping timeout: 383 seconds]
egg|cell|egg has joined #kspacademia
egg|phone|egg has quit [Read error: Connection reset by peer]
egg|laptop|egg has joined #kspacademia
<egg|laptop|egg>
!wpn whitequark and котя
* Qboid
gives whitequark and котя an int variety/shell hybrid
<awang>
!wpn -add:wpn subexpression
<Qboid>
awang: Weapon added!
<awang>
!wpn -add:wpn expression
<Qboid>
awang: Weapon already added!
<awang>
!wpn -add:adj expressive
<Qboid>
awang: Adjective added!
<awang>
!wpn -add:wpn espresso
<Qboid>
awang: Weapon already added!
<egg|laptop|egg>
!wpn -add:wpn flatfish
<Qboid>
egg|laptop|egg: Weapon added!
<egg|laptop|egg>
!wpn -add:wpn sole
<Qboid>
egg|laptop|egg: Weapon added!
<icefire>
!wpn
* Qboid
gives icefire a quasibarreled purpose
<awang>
!wpn -add:wpn porpoise
<Qboid>
awang: Weapon already added!
<awang>
Jeez, finding minimum distance between polygons is a lot more complex than I first thought
<awang>
I'm sort of tempted to eat the O(n * m) and pray that n and m aren't too large
<awang>
If only because it means I could not worry about implementing fun data structures
egg|laptop|egg has quit [Ping timeout: 180 seconds]