CoCalc Shared Filestmp / 2016-02-23-164651.html
Authors: Harald Schilly, ℏal Snyder, William A. Stein
Description: Jupyter html version of tmp/2016-02-23-164651.ipynb
2016-02-23-164651
In [3]:
a = [1 2 3 4 6 4 3 4 5]
Out[3]:
a =

1   2   3   4   6   4   3   4   5

In [4]:
b = a + 2
Out[4]:
b =

3   4   5   6   8   6   5   6   7

In [5]:
plot(b)
grid on
Out[5]:
In [6]:
bar(b)
xlabel('Sample #')
ylabel('Pounds')
Out[6]:
In [7]:
plot(b,'*')
axis([0 10 0 10])
Out[7]:
In [8]:
A = [1 2 0; 2 5 -1; 4 10 -1]
Out[8]:
A =

1    2    0
2    5   -1
4   10   -1

In [9]:
B = A'
Out[9]:
B =

1    2    4
2    5   10
0   -1   -1

In [10]:
C = A * B
Out[10]:
C =

5    12    24
12    30    59
24    59   117

In [11]:
C = A .* B
Out[11]:
C =

1    4    0
4   25  -10
0  -10    1

In [12]:
b = [1;3;5]
x = A\b
Out[12]:
b =

1
3
5

x =

1
-0
-1

In [13]:
r = A*x - b
Out[13]:
r =

0
0
0

In [14]:
eig(A)
Out[14]:
ans =

3.73205
0.26795
1.00000

In [15]:
svd(A)
Out[15]:
ans =

12.31706
0.51490
0.15768

In [16]:
p = round(poly(A))
Out[16]:
p =

1  -5   5  -1

In [17]:
roots(p)
Out[17]:
ans =

3.73205
1.00000
0.26795

In [18]:
q = conv(p,p)
Out[18]:
q =

1  -10   35  -52   35  -10    1

In [19]:
r = conv(p,q)
plot(r);
Out[19]:
r =

1   -15    90  -278   480  -480   278   -90    15    -1

In [20]:
whos
Out[20]:
Variables in the current scope:

Attr Name             Size                     Bytes  Class
==== ====             ====                     =====  =====
A                3x3                         72  double
B                3x3                         72  double
C                3x3                         72  double
_fig             1x1                          8  double
_figHandles      1x1                          8  double
_filename        1x27                        27  char
_handle          1x1                          8  double
a                1x9                         72  double
ans              3x1                         24  double
b                3x1                         24  double
p                1x4                         32  double
q                1x7                         56  double
r                1x10                        80  double
theta            1x6284                      24  double
x                3x1                         24  double

Total is 6380 elements using 603 bytes

In [21]:
A
Out[21]:
A =

1    2    0
2    5   -1
4   10   -1

In [22]:
sqrt(-1)
Out[22]:
ans =  0 + 1i
In [ ]: