Posts

Book Review : Python Programming Exercises, Gently Explained

 "Python Programming Exercises, Gently Explained"! This book is authored by Al Sweigart, the creator of "Automate the Boring Stuff with Python". In this book, you will find a collection of programming exercises that are designed to help you learn Python in a fun and engaging way. Whether you are a beginner or an experienced programmer, these exercises will challenge you and help you improve your skills. The purpose of the programming exercises in this book: The purpose is to help readers learn Python in a fun and engaging way. The exercises are designed to challenge readers and improve their coding skills, covering a range of topics such as basic syntax, data structures, functions, and more. Each exercise is accompanied by a detailed explanation of the solution, as well as tips and tricks to help readers improve their coding skills. The exercises are suitable for both beginners and experienced programmers, and are intended to help readers develop their programming e

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 = collect ( 10 : 49 )   8. Return t