« first day (1861 days earlier)      last day (1351 days later) » 

9:01 AM
Anybody else thinks this answer deserves some more upvotes?
 
9:17 AM
@AnderBiguri do you remember the strange bug where a figure becomes animated spontaneously? Do you have access to a setup that exhibits this behavior and can verify if the suggested solution stops it from happening?
What's up?
 
@Dev-iL Keyboard going nuts with tab completion... idk why. Anyways that was both a really good question and a very nice answer.
 
@Peter link?
 
the one you linked to. with oddly few upvotes considering the extensive answer.
 
Oh, I thought you were referring to a q&a about tab completion
 
no no... it was my own keyboard acting up causing those deleted lines... no idea why
 
9:25 AM
@Peter The first revision of the answer was much shorter, perhaps that's the reason.... As for the question, thanks for the compliment :)
 
 
2 hours later…
11:29 AM
@Dev-iL ah trippy! I dont have those versions available now, as I am in Spain and hve only 2017
 
 
1 hour later…
12:30 PM
@AnderBiguri no more londonizing?
 
1:15 PM
@flawr just a small break
 
ah I see:)
 
1:51 PM
just found a neat expression for finding the smallest angle difference between two angles: atan2(sin(a-b), cos(a-b))
 
2:28 PM
@flawr I'd expect min(mod(a-b, 2*pi), mod(b-a, 2*pi)) to be a lot faster and more readable :P
 
@AndrasDeak don't we need to add an absolute value somewhere?
 
That's what a-b vs b-a is supposed to do. I didn't test it though...
 
or in other words, is the output of mod assumed to be nonnegative?
 
yes
 
ok, well the atan2 expression can assume negative values
but the min-mod is really elegant I have to say!
 
2:32 PM
Yeah, I get different results. What exactly is your specification?
 
get the signed difference with the least absolute value
 
I see
even the values where you've got a positive angle are different in mine, so it's probably buggy
 
wait, then maybe mine is wrong
D:
 
well, generate a mesh, compute the angle, plot it and see if it matches your expectations
a 2pi x 2pi grid should cover all cases at worst
 
in matlab both our versions give the same answers up to the sign!
 
2:38 PM
hmmm
now that's weird
Are you sure?
 
for k = 1:1000;
    a = 4*pi*rand() - 2*pi;
    b = 4*pi*rand() - 2*pi;
    x = atan2(sin(a-b), cos(a-b));
    y = min(mod(a-b, 2*pi), mod(b-a, 2*pi));
    if abs(x - y) > 1e-5
        if abs(x + y) > 1e-5
            disp([x,y])
        end
    end
end
 
oh crap, I derped up my modulo
>>> a,b = np.mgrid[0:2*np.pi:100j, 0:2*np.pi:100j]
... np.allclose(abs(np.arctan2(np.sin(a-b), np.cos(a-b))), np.minimum((a-b) % (2*np.pi), (b-a) % (2*np.pi)))
True
I remembered to parenthesize (a-b) but not (2*np.pi)...
 
oh mgrid is nice
 
yup
 
a complete hack with using complex numbers:)
interesting, when you do np.mgrid[0:2:3j+5] you actually get 5 samples
hmm, I don't get it
 
2:45 PM
@flawr it's a hack entirely
@flawr if it's complex it probably takes the abs()
>>> np.mgrid[0:2:3j]
array([0., 1., 2.])

>>> np.mgrid[0:2:3j+1]
array([0.        , 0.92495059, 1.84990118])

>>> np.mgrid[0:2:3j+2]
array([0.        , 0.76759188, 1.53518376])

>>> np.mgrid[0:2:3j+3]
array([0.        , 0.61678126, 1.23356251, 1.85034377])

>>> np.mgrid[0:2:3j+4]
array([0. , 0.5, 1. , 1.5, 2. ])

>>> abs(3j+4)
5.0
 
> then the integer part of its magnitude is interpreted as specifying the number of points
but why do we then get a different spacing?
oh to compute the interval length they still use the absolute value and not just its integer part!
 
Sam
3:19 PM
hello all
 
 
3 hours later…
6:12 PM
@Sam hello!
 
 
4 hours later…
10:07 PM
@CrisLuengo your colon-analysis (can we call that a colonoscopy? :) was cited here: possiblywrong.wordpress.com/2020/08/02/…
 
10:23 PM
*colonopscopy
 
10:45 PM
@flawr LOL! "colonopsis" is less funny, but also less insulting... :p
 

« first day (1861 days earlier)      last day (1351 days later) »