« first day (1800 days earlier)      last day (1413 days later) » 

8:32 AM
@LuisMendo unless the students don't give a shit
 
8:58 AM
Well, there're always some who do :-)
 
 
1 hour later…
10:05 AM
I know that legendre() exists in MATLAB, but I can't seem to find a derivative function. I need that, since for calculation of spherical harmonics you need the derivative d P(cos theta)/d theta. I know SciPy's Legendre-suite does have it, does anyone know whether MATLAB does as well?
I can of course use a numerical derivative (my current code does), but having it built-in like in SciPy would be better IMO
 
@Adriaan hum, legendre seems to give the "associate legendre fucntions" which are the derivative of legendre polinomials, acording to docs
Just in case that is what you wanted
 
@AnderBiguri Yea, the Schimdt semi-normalised asosciated legendre functions $P_n^m (\cos \theta)$ are my "normal" spherical harmonic basis functions. However, they are the basis for my scalar potential V, and I need the magnetic field: B = -\nabla V, i.e. the derivatives. With respect to r and \phi these are trivial, but with respect to \theta I need that derivative I mentioned.
 
mayne you need to code it yourself :(
 
if nargout > 1 % also calculation of B_theta
        dPnm(:,n+1) =  (sqrt(n/2).*Pnm(:,n));      % m = n
        dPnm(:,1) = -sqrt(n*(n+1)/2.).*Pnm(:,2);   % m = 0

        if n > 1                                   % m = 1
            dPnm(:,2)=(sqrt(2*(n+1)*n).*Pnm(:,1)-sqrt((n+2)*(n-1)).*Pnm(:,3))/2;
        end

        for m = 2:n-1                              % m = 2...n-1
            dPnm(:,m+1)=(sqrt((n+m)*(n-m+1)).*Pnm(:,m)-sqrt((n+m+1)*(n-m)).*Pnm(:,m+2))/2;
        end

        if n == 1
That's the current code for the derivative... Not pretty, but it works.
 
looks good to me to be fair
 
10:13 AM
Sure, but I was just wondering, since SciPy does have automated calculation of derivatives, whether MATLAB had included something as well
 
I'd be suprised if it exist and its not mentioned in the "see also" section of the doc (which is not)
 
Sam
10:43 AM
@AndrasDeak do you use pytest?
 
10:55 AM
Not really. If I wrote tests I'd use pytest though.
 
 
1 hour later…
12:05 PM
@Adriaan what package/module are you referring to?
(regarding the automatic differentiation)
 
that looks lke its doing the same as legendre()
 
@Adriaan sorry I was asking for the autograd:)
 
@AnderBiguri check the second return
 
a right, ant its derivative
 
12:09 PM
@flawr what I linked, second return, does give me the derivative
 
ah so this is not about automatic differentiation, but just a function that returns also the derivative of this specific funcion?
 
@flawr yea, sorry
 
I was checking the source, does not seem to complicated to implement/copy
its recursive tho
 
Point is: you need that specific derivative for spherical harmonics, but it's a pain in the behind to calculate, hence my disappointment that MATLAB doesn't automatically give it
@AnderBiguri I might as well stick to my original in that case
 
and a numerical derivative is not enough?
 
12:13 PM
Yes, it is, but again that's more lines of code than I appreciated, see what I wrote up a bit
 
12:30 PM
Yeah, I don't think scipy has anything in the way of autograd. That's more of a symbolic math thing, is it not?
 
Sam
@AndrasDeak Yeah. Just started using it now
from unittest
 
me: displaying data. disp(num2str(data)). Want to display percentage, and do disp(num2str(data)*100)
ዀᇸዀጤᗠᎈᏬᕼ
aaaaaaaaaa
 
@AndrasDeak apart from tf/pytorch (both not really numpy or scipy, but quite compatible with numpy) there also seems to be a newish thing called "jax" from google: github.com/google/jax
@AnderBiguri google translate
 
ah, now I get it. Amharic to english: Ꮼᕼ ᇸ ዀ ᗠᎈ Ꮼᕼ Ꮼᕼ Ꮼᕼ Ꮼᕼ Ꮼᕼ Ꮼᕼ Ꮼᕼ Ꮼᕼ Ꮼᕼ
 
:P
 
12:45 PM
@Sam unittest and pytest are two very different things as far as I know
@AnderBiguri heh
 
Sam
Yeah, I don't actually think pytest gives you any fancy assert statements other than the norm, but they give you good patching
I guess it's seen as an addition?
@AnderBiguri I wonder if this would be an out-of-vocab word in embedding models :p
@AnderBiguri also.... wtf, 30.5k!
 
That is what I say every-time I use a function without docs :D
@Sam my rep graph actually look like log(time) for a large value of time
I do contribute less and less
 
Sam
Andras has blown up too. I remember not so long ago(?) being on ~17k
I think I've peaked at 614
 
@Sam late 2018 :P
 
Sam
Yup. My inflection point
Late 2018 was a good time for me. 2020 has flatlined. Like the world
 
12:59 PM
@Sam you wanna say this is all your fault? D:
 
Sam
There's defo a correlation. Can't determine the relationship
 
hehe
 
1:28 PM
@Sam I don't know what it does differently, but I think unittest is usually accused of having strong java opinions, being based on JUnit or something. The people I know who do testing tend to prefer pytest.
@Sam what Ander said. I've been mostly inactive for a long time. A question has to be very interesting and lucky for me to decide to answer it.
 
@AndrasDeak you do seem to have quite a linear rep change tho. Maybe just your less answers are much better, which is good ;)
 
the y axis is tricky
log will be linear on a sufficiently zoomed-in scale
 
hehe fair
 
I did post my second Q&A in 2018...
that probably kicked it up. Without some of those jumps it would be more logarithmic, I bet
and I did answer a bit when the python gold badge got near
 

« first day (1800 days earlier)      last day (1413 days later) »