How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
I just started to learn some python today for first time, so be easy on me. I am having some trouble figuring how do the problem shown in this link http://12000.org/my_notes/mma_matlab_control/KERNEL/KEse44.htm Given 4 column vectors, v1,v2,v3,v4, each is 3 rows. I want to use these to

Re: How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
On 6/20/2015 9:20 PM, MRAB wrote: Here's one way, one step at a time: r1 = np.concatenate([v1, v2]) r1 array([1, 2, 3, 4, 5, 6]) r2 = np.concatenate([v3, v4]) r2 array([ 7, 8, 9, 10, 11, 12]) m = np.array([r1, r2]) m array([[ 1, 2, 3, 4, 5, 6], [ 7, 8, 9, 10, 11, 12]])

Re: How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
On 6/20/2015 10:47 PM, Nasser M. Abbasi wrote: I did manage to find a way: - r1 =np.hstack([(v1,v2)]).T r2 =np.hstack([(v3,v4)]).T mat = np.vstack((r1,r2)) - Out[211]: array([[ 1, 4], [ 2, 5], [ 3, 6

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Nasser M. Abbasi
On 04/29/2012 05:17 PM, someone wrote: I would also kindly ask about how to avoid this problem in the future, I mean, this maybe means that I have to check the condition number at all times before doing anything at all ? How to do that? I hope you'll check the condition number all the time.

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Nasser M. Abbasi
On 04/29/2012 07:59 PM, someone wrote: Also, as was said, do not use INV(A) directly to solve equations. In Matlab I used x=A\b. good. I used inv(A) in python. Should I use some kind of pseudo-inverse or what do you suggest? I do not use python much myself, but a quick google showed

Re: numpy (matrix solver) - python vs. matlab

2012-04-29 Thread Nasser M. Abbasi
On 04/29/2012 07:17 PM, someone wrote: Ok. When do you define it to be singular, btw? There are things you can see right away about a matrix A being singular without doing any computation. By just looking at it. For example, If you see a column (or row) being a linear combination of