Matlab

chapter 1

 rand 
uniform distribution
 randn
gauss distribution
 whos
shows already defined variables and their memory usage.
 A=[1 2 3; 5 6 7]
yields the matrix with lines (1,2,3) and as second line (5,6,7). With A(2), A(:,2), A(1,:) you can touch the elements, columns and lines.
 x=[0:8 7:-1:2 3:6 5 4 5 5 5];
means x gets the values 0 until 8, then 7 until 2 with -1 as decrease and then 5, 4, and three 5s.
 plot(x)
 plot(x,'*')
plots the values of x
 [X,Y] = meshgrid(x,y);
 Z=X.^2+Y.^2
 subplot(1,2,2)
 surf(X,Y,Z)

 sinus(x)

overview 1

overview 2

Numbers

 3
 9.6397238
 1i
 -99
 1.60210e-20
 -3.14159j
 0.0001
 6.02252e23
 3e5i
 pi
 i
 j (same as i)
 Inf
 NaN

M-Files

create file containing these lines

 A = [ ...
 1 0 0 0 
 0 1 0 0 
 0 0 1 0 ];

Store the file under magik.m, afterwards you can load this file with

 magik

Deleting Rows and Columns

 X = A;
 X(:,2) = []
deletes second column of X
 X(2:2:10 = []
results not in a matrix but in a row vector filled with the remaining elements.
 e = eig(A)
eigenvalues of A
 poly(A)
characteristic polynomial of A ( det(A-lambda*I) )

Building tables

 n = (0:9)';
the dash is for the column write style instead of the linewise style
 pows = [n  n.^2  2.^n]

 pows =

     0     0     1
     1     1     2
     2     4     4
     3     9     8
     4    16    16
     5    25    32
     6    36    64
     7    49   128
     8    64   256
     9    81   512

Useful is also the building of value tables like logarithm.

 format short g
 x = (0.1:0.5:10)';
 logs = [x log10(x)]

logs =

          0.1           -1
          0.6     -0.22185
          1.1     0.041393
          1.6      0.20412
          2.1      0.32222
          2.6      0.41497
          3.1      0.49136
          3.6       0.5563
          4.1      0.61278
          4.6      0.66276
          5.1      0.70757
          5.6      0.74819
          6.1      0.78533
          6.6      0.81954
          7.1      0.85126
          7.6      0.88081
          8.1      0.90849
          8.6       0.9345
          9.1      0.95904
          9.6      0.98227


 EDU>> x = [4/3 1.2345e-6]
 x =
       1.3333   1.2345e-06
 EDU>> format short
 EDU>> x
 x =
    1.3333    0.0000
 EDU>> format short e
 EDU>> x
 x =
   1.3333e+00   1.2345e-06
 EDU>> format short g;x
 x =
       1.3333   1.2345e-06
 EDU>> format long;x
 x =
   1.33333333333333   0.00000123450000
 EDU>> format long e;x
 x =
     1.333333333333333e+00     1.234500000000000e-06
 EDU>> format long g;x
 x =
          1.33333333333333                1.2345e-06
 EDU>> format bank;x
 x =
          1.33          0.00
 EDU>> format rat;x
 x =
       4/3            1/810045
 EDU>> format hex;x
 x =
    3ff5555555555555   3eb4b6231abfd271

cholesky

  A=[4 2 14 4 10 ; 2 10 19 14 11; 14 19 74 51 52; 4 14 51 150 75 ; 10 11 52 75 56]
 chol(A)
delivers cholesky factorization of A. Or more precisely the upper triangle matrix of A=R'*R where R' is the transposed matrix of R.

This can be quickly solved by:

 R=chol(A);
 x = R\(R'\[136;227;790;811;656])
where forward and backward substitution are one step or with
 y = R'\[136;227;790;811;656
 x = R\y

chapter 2