[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: declaring a scalar

**From**: |
Geordie McBain |

**Subject**: |
Re: declaring a scalar |

**Date**: |
Tue, 10 Apr 2007 13:59:50 +1000 |

Yes, most of the time, but a little catch (which can be difficult to
debug) is that if k is a scalar, u a length n column vector, and A is an
n*n matrix, then sometimes mathematically we think k*u + A*u is the same
as (k+A)*u, but to get it in Octave we need (k*eye(n)+A)*u.
On Sun, 2007-04-08 at 16:36 -0700, Paul Roberts wrote:
>* I believe that in octave, a 1x1 matrix is treated as a scalar, so you*
>* may write your code assuming that if you say x=2, then the variable x*
>* will behave like a scalar variable with value 2.*
>* *
>* Paul*
>* *
>* On 4/8/07, Vivek Rao <address@hidden> wrote:*
>* > x = 2*
>* >*
>* > creates a 1-by-1 matrix. How can I create a scalar*
>* > variable with value 2? Thanks.*
>* >*
>* > Vivek Rao*