help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## Re: x = Z\z

 From: Martin Helm Subject: Re: x = Z\z Date: Fri, 7 Jan 2011 00:56:05 +0100 User-agent: KMail/1.13.5 (Linux/2.6.34.7-0.7-desktop; KDE/4.5.4; x86_64; ; )

```Am Freitag, 7. Januar 2011, 00:08:39 schrieb oort:
> Hello.
>
> If x = Z\z is the solution of Zx=z and only square systems have solution
> then why the operation of non-square matrices Z gives "numerical values"?
> Don't you think that it should give some error message?
>
> For instance:
>
> octave:1> A = [3, 2, 6; 2, -2, 1; -1, 0.5, 3]
> A =
>
>    3.00000   2.00000   6.00000
>    2.00000  -2.00000   1.00000
>   -1.00000   0.50000   3.00000
>
> octave:2> a = [1; 2; 3]
> a =
>
>    1
>    2
>    3
>
> octave:3> A\a
> ans =
>
>   -0.74684
>   -1.26582
>    0.96203
>
> OK... "A" is a 3x3 matrice and "a" is a 3x1 matrice
>
> But:
>
> octave:4> B = [3, 2; 2, -2; -1, 0.5]
> B =
>
>    3.00000   2.00000
>    2.00000  -2.00000
>   -1.00000   0.50000
>
> octave:5> b = [1; 2; 3]
> b =
>
>    1
>    2
>    3
>
> octave:6> B\b
> ans =
>
>    0.29801
>   -0.11479
>
> Now we have a system of 3 equations and 2 variables. It's a overdefined
> system. Curiously B*x does not give equal to "b"...
>
>
> And if we use a underdefined system we aldo reach a "numeric" result.
>
> octave:7> C = [3, 2, 6; 2, -2, 1]
> C =
>
>    3   2   6
>    2  -2   1
>
> octave:8> c = [1; 2]
> c =
>
>    1
>    2
>
> octave:9> C\c
> ans =
>
>    0.42175
>   -0.51459
>    0.12732
>
> How it is possible to have a "result" from a underdifined system?
> Curiously  if we put a third row with zeros in C and if we calculate C*x we
> obtain "c". However in octave x = [0.42175; -0.51459; 0.12732] and in
> MATLAB x = [0; -0.7857; 0.4286]

Ocatve \ operator also solves under- and overdetermined  systems in the
minimum norm and least squares sense respectively. that is the reason why this
works. it is not an error.

```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]