Lösungen

A. 1- 5  mit einem frei gewählten Tool oder Rechner
B. 1 - 8 mit Octave

A.

1

\(Gegeben\ sind\ \ im\ 5 - 
        dimensionalen\ Raum\ die\ Punke\ P\_\(\([[\)\(1\)\(]]\)\) = \ \(\((3, 5, 6, 9, 
            2)\)\ und\ \ P\_\(\([[\)\(2\)\(]]\)\) = \((\(-1\), 3, 4, 2, 8)\)\  . \ 
            Berechne\ die\ Länge\ des\ Vektors\ von\ P\_\(\([[\)\(1\)\(]]\)\)\ zu\ \(P\_\(\(\([[\)\(2\)\(]]\)\)\(\ \)\)\) 
          sowie\ die\ Länge\ der\ Projektion\ des\ \ Vektors\ in\ den\ Unterraum\ \ mit\ den\ ersten\ 3\ Koordinaten . \ 
            Was\ passiert\ allgemein\ mit\ der\ Länge\ eines\ Vektors\ bei\ der\ Projektion\ in\ einen\ \(\(Unterraum\)\(?\)\)\)\)

OP1 = {3, 5, 6, 9, 2};     OP13 = {3, 5, 
        6};    
OP2 = {-1, 3, 4, 2, 8} ;  
    OP23 = {-1, 3, 4} ;
Norm[OP1 - OP2 ]

N[%]

Norm[OP13 - OP23 ]

N[%]

Der  Projektionsvektor im Unterraum ist kürzer oder gleich lang wie der ursprüngliche Vektor.

2

Gegeben ist a=(3, 5, 6, 9, 2),  b=(-1, 3, 4, 2, 8), c=(-3, -3, -2, -2 - 1), d=(1, 2, 4, 6, 7)  .  Berechne 4 a - 3b + 5 c  und löse die Gleichungen  4 a + 2 (x - b)+5  c=d+8b .

a = {3, 5, 6, 9, 2}; 
b = {-1, 3, 4, 2, 8} ; 
c = {-3, -3, -2, -2, -1};
d = {1, 2, 4, 6, 
          7};
Print[4 a - 3b + 5 c];
solv = 
        Solve[4 a  +  2 ({x1, x2, x32, x4, x5} - b) + 5  c == 
              d + 8  b, {x1, x2, x32, x4, x5} ] // Flatten

{x1, x2, x32, x4, x5} /. solv

%  // N

3

a

v ist gegeben durch die Koordinaten (-2,0,4,6,8),  a1 durch (-1,3,4,2,8), a2 durch (-3,-3,-2,-2,-1), a3 durch (-3,-3,-2,-2,-1), a4 durch (1,2,4,6,7) und a5 durch (4,2,4,6,7). Drücke v in der "Basis" {a1, a2, a3, a4, a5} aus.

a1 = {-1, 3, 4, 2, 8} ; 
a2 = {-3, -3, -2, -2, -1};
a3 = a2;
a4 = {1, 2, 4, 6, 7};
a5 = {4, 2, 4, 6, 7};
v = {-2, 0, 4, 6, 8};
Solve[
      v == λ1 a1 + λ2 a2 + λ3 a3 + λ4 a4 + λ5 a5, {λ1, λ2, λ3, λ4, λ5}]

N[%]

== >  {a1, a2, a3, a4, a5} ist keine Basis!

b

v ist gegeben durch die Koordinaten (-2,0,4,6,8),  b1 durch 3,5,6,9,2), b2 durch (-1,3,4,2,8), b3 durch (-3,-3,-2,-2,-1), b4 durch (1,2,4,6,7) und b5 durch (4,2,4,6,7). Drücke v in der Basis {b1, b2, b3, b4, b5} aus.

b1 = {3, 5, 6, 9, 2}; 
b2 = {-1, 3, 4, 2, 8} ; 
b3 = {-3, -3, -2, -2, -1};
b4 = {1, 2, 4, 6, 7};
b5 = {4, 2, 4, 6, 7};
v = {-2, 0, 4, 6, 8};
Solve[
      v == λ1 b1 + λ2 b2 + λ3 b3 + λ4 b4 + λ5 b5, {λ1, λ2, λ3, λ4, λ5}]

N[%]

== >  Streckungsfaktoren!

4

a

Seien (-4,10,24,31,43) die Koordinaten eines Ortsvektors w. Ist w linear abhängig von {a1, a2, a3, a4, a5}?  ({a1, a2, a3, a4, a5} wie oben.)

Solve[{-4, 10, 24, 31, 
          43} ==  λ1 a1 + λ2 a2 + λ3 a3 + λ4 a4 + λ5 a5, {λ1, λ2, λ3, λ4, λ5}]

== >  Linear unabhängig!

b

Seien (-4,10,24,31,43) die Koordinaten eines Ortsvektors w. Ist w linear abhängig von {b1,b2,b3,b4,b5}?  ( {b1,b2,b3,b4,b5} wie oben.)

Solve[{-4, 10, 24, 31, 
          43} ==  λ1 b1 + λ2 b2 + λ3 b3 + λ4 b4 + λ5 b5, {λ1, λ2, λ3, λ4, λ5}]

b1+2  b2+3  b3+4  b4+0b4   (* = w *)

== >  Linear abhängig!

c

Seien (4,-10,-24,31,43) die Koordinaten eines Ortsvektors w. Ist w linear abhängig von {a1, a2, a3, a4, a5}?  ({a1, a2, a3, a4, a5} wie oben.)

Solve[{4, -10, -24, 31, 
          43} ==  λ1 a1 + λ2 a2 + λ3 a3 + λ4 a4 + λ5 a5, {λ1, λ2, λ3, λ4, λ5}]

== >  Linear unabhängig!

d

Seien (4,-10,-24,31,43) die Koordinaten eines Ortsvektors w. Ist w linear abhängig von {b1,b2,b3,b4,b5}? ({b1,b2,b3,b4,b5} wie oben.)

Solve[{4, -10, -24, 31, 
          43} ==  λ1 b1 + λ2 b2 + λ3 b3 + λ4 b4 + λ5 b5, {λ1, λ2, λ3, λ4, λ5}]

N[%]

== >  Linear abhängig!

5

Der Ortsvektor von a habe die Koordinaten (1,1,1), derjenige von b(n) die Koordinaten (n/2, 2/n, 3/n^2). Berechne die Summe 
a - b(1) + b(2) - b(3) + ... - .. + b(100).

Remove[a, b, c];
a = {1, 1, 1};
b[n_] := {n/2,  2/n,  3/n^2};
a + Sum[b[n], {n, 1, 100}]

%  // N

B.

B 1

B 1 a

>> x=[1 3 2]; y=[2 4]; z=[2*x 1./y];                                                                                                                             
>> z
z =

  2.00000  6.00000  4.00000  0.50000  0.25000

B 1 b

>> log10(1:20)
ans =

 Columns 1 through 17:

  0.00000  0.30103  0.47712  0.60206  0.69897  0.77815  0.84510  0.90309  0.95424  1.00000  1.04139  1.07918  1.11394  1.14613  1.17609  1.20412  1.23045

 Columns 18 through 20:

  1.25527  1.27875  1.30103

B 2

>> a=0:14;b=[1:7 8 7:-1:1];

>> b
b =

        1        2        3        4        5        6        7        8        7        6        5        4        3        2        1

>> a+b
ans =

        1        3        5        7        9       11       13       15       15       15       15       15       15       15       15

>> a.*b
ans =

        0        2        6       12       20       30       42       56       56       54       50       44       36       26       14

>> [a,b]
ans =

 Columns 1 through 17:

        0        1        2        3        4        5        6        7        8        9       10       11       12       13       14        1        2

 Columns 18 through 30:

        3        4        5        6        7        8        7        6        5        4        3        2        1

>> mean(b)
ans = 4.2667

>> Mean(b)
ans = 4.2667

>> plot(a,b)
===> Plot

>> Plot(b,a,'+')
===> Plot

>> min([a b])
ans = 0

>> plot(a,b.^2)
===> Plot

>> a(a>8)
ans =

        9       10       11       12       13       14

>> b(b<6)
ans =

        1        2        3        4        5        5        4        3        2        1

>> size(a.')
ans =

       15        1

B 3

>> 1:10-1
ans =

  1  2  3  4  5  6  7  8  9

>> 1:(10-1)
ans =

  1  2  3  4  5  6  7  8  9

>> (1:10)-1
ans =

        0        1        2        3        4        5        6        7        8        9
        
>> v=[3:3:10, 12:-2:5]
v =

        3        6        9       12       10        8        6

>> v(v<=9)
ans =

        3        6        9        8        6

>>

B 4

>> x=rand(1,50)
x =

 Columns 1 through 17:

  0.34648  0.82935  0.09303  0.40889  0.10296  0.50698  0.20875  0.26299  0.33868  0.35888  0.41609  0.95525  0.31984  0.74357  0.91712  0.46405  0.40900

 Columns 18 through 34:

  0.58887  0.87234  0.70238  0.38074  0.00635  0.18831  0.47917  0.11302  0.37883  0.04822  0.54776  0.19099  0.62473  0.98923  0.88067  0.30988  0.19172

 Columns 35 through 50:

  0.08986  0.15255  0.98137  0.32748  0.05883  0.13249  0.40420  0.55309  0.72537  0.67042  0.54330  0.52706  0.35910  0.61331  0.50355  0.63506

>> hist(x,n)
error: `n' undefined near line 24 column 8
error: evaluating argument list element number 2


>> help hist
hist is the user-defined function from the file
/usr/share/octave/2.1.42/m/plot/hist.m

 - Function File:  hist (Y, X, NORM)
     Produce histogram counts or plots.

     With one vector input argument, plot a histogram of the values with
     10 bins.  The range of the histogram bins is determined by the
     range of the data.

     Given a second scalar argument, use that as the number of bins.

     Given a second vector argument, use that as the centers of the
     bins, with the width of the bins determined from the adjacent
     values in the vector.

     If third argument is provided, the histogram is normalised such
     that the sum of the bars is equal to NORM.

     Extreme values are lumped in the first and last bins.

     With two output arguments, produce the values NN and XX such that
     `bar (XX, NN)' will plot the histogram.

See also: bar.

Additional help for built-in functions, operators, and variables
is available in the on-line version of the manual.  Use the command
`help -i <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the help-octave@bevo.che.wisc.edu
mailing list.
 
>> x=rand(1,50); y=1:100;hist(x,y)
ans = []
===> Plot

>> hist(x,8)
ans = []
===> Plot

>> sowas=hist(x,8)
sowas =

        3        4        5        5       10        6        7       10

>> sowas
sowas =

        3        4        5        5       10        6        7       10

B 5

>> x=1:3:18
x =

   1   4   7  10  13  16

>> x=0:3:18
x =

   0   3   6   9  12  15  18

>> diff(x)
ans =

        3        3        3        3        3        3

>> prod(x)
ans = 0

>> std(x)
ans = 6.4807

>> median(x)
ans = 9

>> x=1:3:19
x =

   1   4   7  10  13  16  19

>> prod(x)
ans = 1106560

B 6

>> x=-4:0.2:4
x =

 Columns 1 through 16:

  -4.00000  -3.80000  -3.60000  -3.40000  -3.20000  -3.00000  -2.80000  -2.60000  -2.40000  -2.20000  -2.00000  -1.80000  -1.60000  -1.40000  -1.20000  -1.00000


 Columns 17 through 32:

  -0.80000  -0.60000  -0.40000  -0.20000   0.00000   0.20000   0.40000   0.60000   0.80000   1.00000   1.20000   1.40000   1.60000   1.80000   2.00000   2.20000


 Columns 33 through 41:

   2.40000   2.60000   2.80000   3.00000   3.20000   3.40000   3.60000   3.80000   4.00000

>> f=e.^(-x./10).*sin(x)
f =

 Columns 1 through 16:

   1.12902   0.89471   0.63428   0.35902   0.08039  -0.19049  -0.44323  -0.66857  -0.85868  -1.00745  -1.11062  -1.16591  -1.17301  -1.13354  -1.05087  -0.92997

 Columns 17 through 32:

  -0.77710  -0.59956  -0.40531  -0.20268   0.00000   0.19474   0.37415   0.53176   0.66220   0.76139   0.82664   0.85671   0.85178   0.81343   0.74447   0.64883

 Columns 33 through 41:

   0.53134   0.39748   0.25318   0.10454  -0.04239  -0.18189  -0.30874  -0.41843  -0.50730

>> plot(x,f)
===> Plot

 f=sin(x.^3);plot(x,f)
 ===> Plot

>> hold on
>> x=-4:0.2:4; f=x.^2;plot(x,f)
 ===> Plot
 
>> f=e.^x ; plot(x,f)
 ===> Plot im selben Diagramm
 
>> x=0:0.2:15; f=e.^(-x./10).*sin(x);

>> [m,i]=max(f)
m = 0.85671
i = 8
>> 

19 c und d mit Octave nicht möglich

B 7

>> a=[1 2 3 4]; ae=sqrt(a*a')
ae = 5.4772

>> function z=u(t)
z=sqrt(t*t')
endfunction
>> a=[1 2 3]
a =

        1        2        3

>> u(a)
z = 3.7417
ans = 3.7417

B 8

>> function z=clearMax(t)
z=t(t<max(t))
endfunction

>> a=[1 2 3 4 5 6 5 4 3 2 1]
a =

 Columns 1 through 8:

        1        2        3        4        5        6        5        4

 Columns 9 through 11:

        3        2        1

>> clearMax(a)
z =

 Columns 1 through 8:

        1        2        3        4        5        5        4        3

 Columns 9 and 10:

        2        1

ans =

 Columns 1 through 8:

        1        2        3        4        5        5        4        3

 Columns 9 and 10:

        2        1


>> clearMax(clearMax(a))
z =

 Columns 1 through 8:

        1        2        3        4        5        5        4        3

 Columns 9 and 10:

        2        1

z =

        1        2        3        4        4        3        2        1

ans =

        1        2        3        4        4        3        2        1