Posts

Idempotent matrices in Julia

Let A be a square matrix of order n . Then A is called an idempotent matrix if AA = A . If a matrix A is idempotent, it follows that A n = A , ∀ n ∈ N . Idempotent matrices behave like identity matrices when raised to a power n . All Idempotent matrices except identity matrices are singular matrices. One way to make idempotent matrices is A = I − u u T , where u is a vector satisfying u T u = 1 . In this case A is symmetric too. #Idempotent matrices in Julia using LinearAlgebra u = rand ( 5 ) u = u / norm ( u ) #Force u^T * u = 1 A = I - u * u ' isapprox ( A ^ 100 , A ) # true isequal ( A , A ' ) # true (test for symmetricity)

100 Julia exercises with solutions

100_Julia_exercises_First50 Here is a Julia version of exercises with solutions which is based on the exercises given here: https://github.com/rougier/numpy-100 1. Import the julia package LinearAlgebra under the name la 1 import LinearAlgebra as la #or 2 import LinearAgebra 3 const la = LinearAlgebra   2. Print the version of julia package Javis xxxxxxxxxx 2 1 ] 2 status Javis   3. Create a zero vector of size 10 and of type Int64 xxxxxxxxxx 1 1 a = zeros ( Int64 , 10 )   4. How to find the memory size of any array in bytes xxxxxxxxxx 2 1 sizeof ( a ) 2 length ( a ) * sizeof ( eltype ( a ))   5. How to get the documentation of the Julia zero function from the command line? xxxxxxxxxx 1 1 ? zeros   6. Create a Int vector of size 10 but the fifth value which is 1 (in two lines of code) xxxxxxxxxx 2 1 a = zeros ( Int , 10 ) 2 a [ 5 ] = 1   7. Create a vector with values ranging from 10 to 49 xxxxxxxxxx 2 1 a = [ 10 : 49 ;] 2 a = coll...