Skip to main content
added 106 characters in body
Source Link
Giuseppe
  • 28.8k
  • 3
  • 31
  • 105

R, 7272 61 bytes

function(A,V=t(A/sum(diag(A%*%t(A))))){for(i in 1:1e4)V=2*V-V%*%A%*%V;V}

Try it online!

Porting Sisyphus' answer is not futile at all...and thanks to Sisyphus for -11 bytes.

Observes that \$Tr(AA^T)=\sum\limits_{i,j}a_{ij}^2\$.

R, 94 bytes

function(M)outer(k<-1:dim(M),k,Vectorize(function(j,i)det(M[-i,-j,drop=F])*(-1)^(i+j)))/det(M)

Try it online!

Thanks to Robin Ryder for fixing a bug and making this actually work.

Calculates \$A^{-1}\$ using the adjugate/determinant method.

R, 72 bytes

function(A,V=t(A/sum(diag(A%*%t(A))))){for(i in 1:1e4)V=2*V-V%*%A%*%V;V}

Try it online!

Porting Sisyphus' answer is not futile at all.

R, 94 bytes

function(M)outer(k<-1:dim(M),k,Vectorize(function(j,i)det(M[-i,-j,drop=F])*(-1)^(i+j)))/det(M)

Try it online!

Thanks to Robin Ryder for fixing a bug and making this actually work.

Calculates \$A^{-1}\$ using the adjugate/determinant method.

R, 72 61 bytes

function(A,V=t(A/sum(diag(A%*%t(A))))){for(i in 1:1e4)V=2*V-V%*%A%*%V;V}

Try it online!

Porting Sisyphus' answer is not futile at all...and thanks to Sisyphus for -11 bytes.

Observes that \$Tr(AA^T)=\sum\limits_{i,j}a_{ij}^2\$.

R, 94 bytes

function(M)outer(k<-1:dim(M),k,Vectorize(function(j,i)det(M[-i,-j,drop=F])*(-1)^(i+j)))/det(M)

Try it online!

Thanks to Robin Ryder for fixing a bug and making this actually work.

Calculates \$A^{-1}\$ using the adjugate/determinant method.

deleted 32 characters in body
Source Link
Giuseppe
  • 28.8k
  • 3
  • 31
  • 105

R, 72 bytes

function(A,V=t(A/sum(diag(A%*%t(A))))){for(i in 1:1e4)V=2*V-V%*%A%*%V;V}

Try it online!

Porting Sisyphus' answer is not futile at all.

R, 94 bytes

function(M)outer(k<-1:dim(M),k,Vectorize(function(j,i)det(M[-i,-j,drop=F])*(-1)^(i+j)))/det(M)

Try it online!

Thanks to Robin Ryder for fixing a bug and making this actually work.

Calculates \$A^{-1}\$ using the adjugate/determinant method.

R, 94 bytes

function(M)outer(k<-1:dim(M),k,Vectorize(function(j,i)det(M[-i,-j,drop=F])*(-1)^(i+j)))/det(M)

Try it online!

Thanks to Robin Ryder for fixing a bug and making this actually work.

Calculates \$A^{-1}\$ using the adjugate/determinant method.

R, 72 bytes

function(A,V=t(A/sum(diag(A%*%t(A))))){for(i in 1:1e4)V=2*V-V%*%A%*%V;V}

Try it online!

Porting Sisyphus' answer is not futile at all.

R, 94 bytes

function(M)outer(k<-1:dim(M),k,Vectorize(function(j,i)det(M[-i,-j,drop=F])*(-1)^(i+j)))/det(M)

Try it online!

Thanks to Robin Ryder for fixing a bug and making this actually work.

Calculates \$A^{-1}\$ using the adjugate/determinant method.

deleted 32 characters in body
Source Link
Giuseppe
  • 28.8k
  • 3
  • 31
  • 105

R, 89 85 8494 bytes

function(M){forouter(i in k<-1:dim(x<-M))for,k,Vectorize(function(j in k)x[j,i]=deti)det(M[-i,-j,drop=F])
x*(-1)^(i+j)))/det(M)}

Try it online!Try it online!

-1 thanks to Kirill L.
-1 thanks Thanks to Robin Ryder for fixing a bug and making this actually work.

Calculates \$A^{-1}\$ using the adjugate/determinant method.

R, 89 85 84 bytes

function(M){for(i in k<-1:dim(x<-M))for(j in k)x[j,i]=det(M[-i,-j,drop=F])
x/det(M)}

Try it online!

-1 thanks to Kirill L.
-1 thanks to Robin Ryder

Calculates \$A^{-1}\$ using the adjugate/determinant method.

R, 94 bytes

function(M)outer(k<-1:dim(M),k,Vectorize(function(j,i)det(M[-i,-j,drop=F])*(-1)^(i+j)))/det(M)

Try it online!

Thanks to Robin Ryder for fixing a bug and making this actually work.

Calculates \$A^{-1}\$ using the adjugate/determinant method.

added 93 characters in body
Source Link
Giuseppe
  • 28.8k
  • 3
  • 31
  • 105
Loading
added 87 characters in body
Source Link
Giuseppe
  • 28.8k
  • 3
  • 31
  • 105
Loading
Source Link
Giuseppe
  • 28.8k
  • 3
  • 31
  • 105
Loading