Julia-R Cheatsheet – Mathematical Operations

Mathematical Operations

What are the commands for the most important mathematical operations in Julia and R? The following table translates the most common Julia commands into R language.

Julia R
Dot product
 
dot(a,b)
 
a%*%b
Matrix multiplication
 
A * B
 
A%*%B
Element-wise multiplication
 
A .* B
 
A * B
Matrix to a power
 
A^2
 
require(exem)
A%^%2
Matrix to a power, elementwise
 
A.^2
 
A^2
Inverse
 
inv(A)
 
solve(A)
Determinant
 
det(A)
 
det(A)
Eigenvalues and eigenvectors
 
eig(A)
 
eigen(A)
Euclidean norm
 
norm(A)
 
norm(A, type="2")
Solve least squares problem Ax = b
 
A\b
 
solve(a,b)

Complete Julia-R Cheatsheet
1) Creating Vectors
2) Creating Matrices
3) Creating Random Numbers
4) Manipulating Vectors and Matrices
5) Accessing Vector/Matrix Elements

 

 

Advertisements
This entry was posted in Computing and Others, Econometrics, Statistic and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s