I am working in Lankton paper Localizing Region-Based Active Contours that has to do with localized active contours and especially in mean separation energy part. I am stuck in a point that I cannot understand how this is implemented. The equation (17) in this paper is as below.

I downloaded the matlab code for this part from here. The equation (17) in this paper is transformed into matlab code as follows
dphidt = F./max(abs(F)) + λ*curvature
where F is
F = -((u-v).*((I(idx)-u)./Ain+(I(idx)-v)./Aout));
where Ain=Au and Aout=Aυ.
Can anyone help me with the mathematics and explain how (17) is transformed to this code part.How the first part of (17)
((I(idx)-u)^2/Ain-(I(idx)-v)^2/Aout)
transformed to
-((u-v).*((I(idx)-u)./Ain+(I(idx)-v)./Aout));
Thank you