Electricity, Complex Systems, Numerical Analysis, Algorithms, Network.
Jacobian<-function(Y_eq,U_old,phi_old){ J=matrix(nrow=2*length(U_old),ncol=2*length(U_old)) for(i in 1:length(U_old)){ #partial derivatives with respect to phi #P J[i,1:(ncol(J)/2)]=U_old[i]*U_old*(Re(Y_eq[i,])*sin(phi_old[i]-phi_old)-Im(Y_eq[i,])*cos(phi_old[i]-phi_old)) #Q