Re: How to construct matrix from vectors?

2015-06-21 Thread lanuradha
On Sunday, 21 June 2015 20:43:15 UTC+5:30, Dennis Lee Bieber wrote: > On Sun, 21 Jun 2015 09:32:55 +0100, Mark Lawrence declaimed the following: > > >On 21/06/2015 04:47, Nasser M. Abbasi wrote: > > > >> > >> But it is not as intuitive as with Matlab > >> > > > >For those of us who don't know wou

Re: How to construct matrix from vectors?

2015-06-21 Thread Dave Farrance
Out[]: >array([[ 1, 4], >[ 2, 5], >[ 3, 6], >[ 7, 10], >[ 8, 11], >[ 9, 12]]) Neat. And if the OP wants "vectors" in np array form to start with, and to stack them together without transposing at that point, he could do it

Re: How to construct matrix from vectors?

2015-06-21 Thread Fabien
On 06/21/2015 07:21 AM, Nasser M. Abbasi wrote: v1=np.array([(1,2,3)]).T v2=np.array([(4,5,6)]).T v3=np.array([(7,8,9)]).T v4=np.array([(10,11,12)]).T mat =np.hstack(( np.vstack((v1,v3)), np.vstack((v2,v4))) ) Out[236]: array([[ 1, 4], [ 2, 5], [ 3, 6], [ 7, 10],

Re: How to construct matrix from vectors?

2015-06-21 Thread Mark Lawrence
On 21/06/2015 04:47, Nasser M. Abbasi wrote: But it is not as intuitive as with Matlab For those of us who don't know would you be kind enough to do a cost comparison of Matlab vs Python licenses? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for

Re: How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
y a little closer to Matlab's method: First make all the vectors column vectors v1=np.array([(1,2,3)]).T v2=np.array([(4,5,6)]).T v3=np.array([(7,8,9)]).T v4=np.array([(10,11,12)]).T mat =np.hstack(( np.vstack((v1,v3)), np.vstack((v2,v4))) ) Out[236]: array([[ 1, 4], [ 2, 5],

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 MRAB
On 2015-06-21 02:57, Nasser M. Abbasi wrote: 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

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: Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-24 Thread Deeyana
On Tue, 24 May 2011 13:39:15 -0700, asandroq wrote: > On May 24, 12:27 am, Deeyana wrote: >> >> Classic unsubstantiated and erroneous claim. Scheme does not come OOTB >> with any suitable libraries for host interop and though it can make >> calls to C libraries, doing so is awkward and involves d

Re: Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-24 Thread Chris Angelico
On Tue, May 24, 2011 at 8:27 AM, Deeyana wrote: > Classic unsubstantiated and erroneous claim. Scheme does not come OOTB > with any suitable libraries for host interop and though it can make calls > to C libraries, doing so is awkward and involves difficulties with the > impedance mismatch between

Re: Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-24 Thread asandroq
On May 24, 12:27 am, Deeyana wrote: > > Classic unsubstantiated and erroneous claim. Scheme does not come OOTB > with any suitable libraries for host interop and though it can make calls > to C libraries, doing so is awkward and involves difficulties with the > impedance mismatch between Scheme's

Re: Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-23 Thread Deeyana
On Mon, 23 May 2011 00:52:07 -0700, asandroq wrote: > On May 23, 4:29 am, Deeyana wrote: >> >> You might be interested in Clojure, then. Lists are more abstracted, >> like in Scheme, and vectors and also dictionaries/maps and sets are >> first class citizens along si

Re: Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-23 Thread Antti J Ylikoski
On 23.5.2011 16:39, Pascal J. Bourguignon wrote: torb...@diku.dk (Torben Ægidius Mogensen) writes: Xah Lee writes: Functional Programing: stop using recursion, cons. Use map& vectors. 〈Guy Steele on Parallel Programing〉 http://xahlee.org/comp/Guy_Steele_parallel_computing.html Thi

Re: Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-23 Thread Pascal J. Bourguignon
torb...@diku.dk (Torben Ægidius Mogensen) writes: > Xah Lee writes: > > >> Functional Programing: stop using recursion, cons. Use map & vectors. >> >> 〈Guy Steele on Parallel Programing〉 >> http://xahlee.org/comp/Guy_Steele_parallel_computing.html > > T

Re: Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-23 Thread asandroq
On May 23, 4:29 am, Deeyana wrote: > > You might be interested in Clojure, then. Lists are more abstracted, like > in Scheme, and vectors and also dictionaries/maps and sets are first > class citizens along side lists. And unlike Scheme, Clojure has good > library/host interop s

Re: Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-22 Thread Deeyana
On Sun, 22 May 2011 15:47:53 -0700, Xah Lee wrote: > this is important but i think most lispers and functional programers > still don't know it. > > Functional Programing: stop using recursion, cons. Use map & vectors. > > 〈Guy Steele on Parallel Programin

Functional Programing: stop using recursion, cons. Use map & vectors

2011-05-22 Thread Xah Lee
this is important but i think most lispers and functional programers still don't know it. Functional Programing: stop using recursion, cons. Use map & vectors. 〈Guy Steele on Parallel Programing〉 http://xahlee.org/comp/Guy_Steele_parallel_computing.html btw, lists (as cons, car, cd

Re: Vectors

2011-04-26 Thread Algis Kabaila
On Monday 25 April 2011 20:49:34 Jonathan Hartley wrote: > On Apr 20, 2:43 pm, Andreas Tawn wrote: > > > Algis Kabaila writes: > > > > Are there any modules for vector algebra (three > > > > dimensional vectors, vector addition, subtraction, > > > &g

Re: Vectors

2011-04-25 Thread Jonathan Hartley
On Apr 20, 2:43 pm, Andreas Tawn wrote: > > Algis Kabaila writes: > > > > Are there any modules for vector algebra (three dimensional > > > vectors, vector addition, subtraction, multiplication [scalar > > > and vector]. Could you give me a reference to suc

Re: Vectors

2011-04-25 Thread Algis Kabaila
wrote: > > >>> Are there any modules for vector algebra (three > > >>> dimensional vectors, vector addition, subtraction, > > >>> multiplication [scalar and vector]. Could you give me > > >>> a reference to such module? > > >>

Re: Vectors

2011-04-24 Thread rusi
On Apr 25, 4:49 am, Robert Kern wrote: > On 4/22/11 7:32 PM, Algis Kabaila wrote: > > > > > On Saturday 23 April 2011 06:57:23 sturlamolden wrote: > >> On Apr 20, 9:47 am, Algis Kabaila > > wrote: > >>> Are there any modules for vector algebra (thr

Re: Vectors

2011-04-24 Thread Robert Kern
On 4/22/11 7:32 PM, Algis Kabaila wrote: On Saturday 23 April 2011 06:57:23 sturlamolden wrote: On Apr 20, 9:47 am, Algis Kabaila wrote: Are there any modules for vector algebra (three dimensional vectors, vector addition, subtraction, multiplication [scalar and vector]. Could you give me a

Re: Vectors

2011-04-23 Thread sturlamolden
On Apr 23, 2:26 pm, Algis Kabaila wrote: > I do understand that many people prefer Win32 and > appreciate their right to use what they want.  I just am at a > loss to understand *why* ... For the same reason some people prefered OS/2 or DEC to SunOS or BSD. For the same reason some people prefe

Re: Vectors

2011-04-23 Thread Algis Kabaila
On Saturday 23 April 2011 14:13:31 sturlamolden wrote: > On Apr 23, 2:32 am, Algis Kabaila wrote: > > Thanks for that. Last time I looked at numpy (for Python3) > > it was available in source only. I know, real men do > > compile, but I am an old man... I will compile if it is > > unavoidable,

Re: Vectors

2011-04-22 Thread sturlamolden
On Apr 23, 2:32 am, Algis Kabaila wrote: > Thanks for that.  Last time I looked at numpy (for Python3) it > was available in source only.  I know, real men do compile, but > I am an old man...  I will compile if it is unavoidable, but in > case of numpy it does not seem  a simple matter. Am I bad

Re: Vectors

2011-04-22 Thread Algis Kabaila
On Saturday 23 April 2011 06:57:23 sturlamolden wrote: > On Apr 20, 9:47 am, Algis Kabaila wrote: > > Are there any modules for vector algebra (three dimensional > > vectors, vector addition, subtraction, multiplication > > [scalar and vector]. Could you give me a referen

Re: Vectors

2011-04-22 Thread sturlamolden
On Apr 20, 9:47 am, Algis Kabaila wrote: > Are there any modules for vector algebra (three dimensional > vectors, vector addition, subtraction, multiplication [scalar > and vector]. Could you give me a reference to such module? NumPy Or one of these libraries (ctypes or Cython): BL

Re: Vectors

2011-04-22 Thread Algis Kabaila
On Friday 22 April 2011 11:43:26 Gregory Ewing wrote: > Algis Kabaila wrote: > > the Vector3 class > > is available without any prefix euclid: > > > > import euclid > > v = Vector3(111.., 222.2, 333.3) > > Doesn't work that way for me: > > Python 2.7 (r27:82500, Oct 15 2010, 21:14:33) > [GCC 4.2

Re: Vectors

2011-04-21 Thread Gregory Ewing
Algis Kabaila wrote: the Vector3 class is available without any prefix euclid: import euclid v = Vector3(111.., 222.2, 333.3) Doesn't work that way for me: Python 2.7 (r27:82500, Oct 15 2010, 21:14:33) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "lic

Re: Vectors

2011-04-21 Thread Anssi Saari
Andreas Tawn writes: > You might also want to consider http://code.google.com/p/pyeuclid/ Thanks, I was studying quaternions recently and had to use two packages to get some stuff done. And of course one of them used ass-backwards declaration for a quaternion and one didn't... -- http://mail.py

Re: Vectors

2011-04-21 Thread Algis Kabaila
On Thursday 21 April 2011 01:49:57 Andreas Tawn wrote: > > On Apr 20, 6:43 am, Andreas Tawn wrote: > > > > Algis Kabaila writes: > > > > > Are there any modules for vector algebra (three > > > > > dimensional vectors, vector addition, subtract

RE: Vectors

2011-04-20 Thread Andreas Tawn
> On Apr 20, 6:43 am, Andreas Tawn wrote: > > > Algis Kabaila writes: > > > > > > Are there any modules for vector algebra (three dimensional > > > > vectors, vector addition, subtraction, multiplication [scalar > > > > and vector]. Could y

Re: Vectors

2011-04-20 Thread RJB
On Apr 20, 6:43 am, Andreas Tawn wrote: > > Algis Kabaila writes: > > > > Are there any modules for vector algebra (three dimensional > > > vectors, vector addition, subtraction, multiplication [scalar > > > and vector]. Could you give me a reference to suc

RE: Vectors

2011-04-20 Thread Andreas Tawn
> Algis Kabaila writes: > > > Are there any modules for vector algebra (three dimensional > > vectors, vector addition, subtraction, multiplication [scalar > > and vector]. Could you give me a reference to such module? > > NumPy has array (and matrix) type

Re: Vectors

2011-04-20 Thread Anssi Saari
Algis Kabaila writes: > Are there any modules for vector algebra (three dimensional > vectors, vector addition, subtraction, multiplication [scalar > and vector]. Could you give me a reference to such module? NumPy has array (and matrix) types with support for these basic opera

Re: Vectors

2011-04-20 Thread Chris Rebert
On Wed, Apr 20, 2011 at 12:47 AM, Algis Kabaila wrote: > Hi, > > Are there any modules for vector algebra (three dimensional > vectors, vector addition, subtraction, multiplication [scalar > and vector]. Could you give me a reference to such module? Dunno if it has 3D-specifi

Vectors

2011-04-20 Thread Algis Kabaila
Hi, Are there any modules for vector algebra (three dimensional vectors, vector addition, subtraction, multiplication [scalar and vector]. Could you give me a reference to such module? platform - ubuntu 10.10 (Linux), Python 3.1 or higher. Thanks for your help to avoid re-invention of the

Using vectors in single NLP constraint inside proc iml with call statement

2011-03-15 Thread ayaa
I have two variables that are stored in a data set and also are stored as matrices and vectors. I want to formulate only one constraint that is a function of all the data set's observations (or elements of these vectors) and a decision variable. Suppose the two stored variables (two vectors)

Re: adding vectors

2005-12-19 Thread Terry Hancock
On Mon, 19 Dec 2005 22:06:31 -0500 Andy Leszczynski <[EMAIL PROTECTED]> wrote: > Short question: why (1,"abc",0.3)+(2,"def",10.2) != > (3,"abcdef",10.5)? > > How to elegantly achieve (3,"abcdef",10.5) as a result of > addition ... (a,b,c) is a "tuple", not a "vector". IMHO, the "elegant" thing t

Re: adding vectors

2005-12-19 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes: > >>> map(operator.add, (1, "abc", 0.3), (2, "def", 10.2)) > [3, 'abcdef', 10.5] > > Not having to do the zip is win. operator.add is a lose. I'm not sure > either is what I'd call elegant. Yeah, I didn't bother checking whether you could pass dyadic functio

Re: adding vectors

2005-12-19 Thread Alex Martelli
Andy Leszczynski <[EMAIL PROTECTED]> wrote: > Hi, > > Short question: why (1,"abc",0.3)+(2,"def",10.2) != (3,"abcdef",10.5)? Because '+' applied to sequences means to concatenate them -- a more frequent need than "element by element addition" (which I notice you would NOT want to apply to string

Re: adding vectors

2005-12-19 Thread Mike Meyer
Paul Rubin writes: > Andy Leszczynski <[EMAIL PROTECTED]> writes: >> Short question: why (1,"abc",0.3)+(2,"def",10.2) != (3,"abcdef",10.5)? >> How to elegantly achieve (3,"abcdef",10.5) as a result of addition ... > tuple([(a+b) for a,b in zip((1,"abc",0.3),(2,"def",10.2

Re: adding vectors

2005-12-19 Thread Paul Rubin
Andy Leszczynski <[EMAIL PROTECTED]> writes: > Short question: why (1,"abc",0.3)+(2,"def",10.2) != (3,"abcdef",10.5)? > How to elegantly achieve (3,"abcdef",10.5) as a result of addition ... tuple([(a+b) for a,b in zip((1,"abc",0.3),(2,"def",10.2))]) -- http://mail.python.org/mailman/listinfo/pyt

adding vectors

2005-12-19 Thread Andy Leszczynski
Hi, Short question: why (1,"abc",0.3)+(2,"def",10.2) != (3,"abcdef",10.5)? How to elegantly achieve (3,"abcdef",10.5) as a result of addition ... Andy -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread Peter Otten
lugal wrote: Your code has an undeclared int i in main(). > gseq.erase(0); I think erase() takes a pointer, not the element index: gseq.erase(qseq.begin()); > in the recursive function. Is my C++ translation accurate from the > original Python? Coming from a Python background, you should have

Re: Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread MyHaz
I didn't look at the original code but i you should know that passing vectors directly (i.e by value) to functions is not a good idea (results in big copy), its better to use `const vector<> &` or `vector<> &` (i.e. by reference). In general you should try to reduce the n

Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread lugal
I'm new to C++, coming from a Python background. I wrote the following code in C++ based on the Python code found here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478 //beginning #include #include using namespace std; void looper(vector > nseq, vector comb); vector > master;

Re: Vectors in Visual Python

2005-02-25 Thread Diez B. Roggisch
re taught in my > non-computing subject and hence I have no idea what the below is all > about!! In future example code may be more useful to help newbies like > me :) I think it has been addressed, by Art: """ My understanding: is that VPython "vectors" ar

Re: Vectors in Visual Python

2005-02-24 Thread FLChamp
Thanks for all your help everyone, if only it had addressed what I had asked I may have actually learned something about Python!! If anything was addressed to my problem then it has completely passed me by as most points were clearly made by a computer scientist and I am not one of those in the sl

Re: Vectors in Visual Python

2005-02-10 Thread Arthur
On Thu, 10 Feb 2005 09:59:41 +0100, [EMAIL PROTECTED] (Alex Martelli) wrote: >Arthur <[EMAIL PROTECTED]> wrote: > >> thinking that the visciousness with wihich you were attacking someone >> suggesting a proposal for an optional feature - even if an iill >> adivised proposal for and ill advised opt

Re: Vectors in Visual Python

2005-02-10 Thread Alex Martelli
Arthur <[EMAIL PROTECTED]> wrote: > thinking that the visciousness with wihich you were attacking someone > suggesting a proposal for an optional feature - even if an iill > adivised proposal for and ill advised optional feature (I frankly > don't care much about that part of the discussion one wa

Re: Vectors in Visual Python

2005-02-09 Thread Arthur
On Thu, 10 Feb 2005 00:16:05 +0100, [EMAIL PROTECTED] (Alex Martelli) wrote: > Having found out how to >build a lasting killfile, I'd like to see if using it liberally on >people who appear to post here just to provoke flamewars, rather than to >offer and receive help, and participate in interesti

Re: Vectors in Visual Python

2005-02-09 Thread Arthur
On Thu, 10 Feb 2005 00:16:05 +0100, [EMAIL PROTECTED] (Alex Martelli) wrote: >Arthur <[EMAIL PROTECTED]> wrote: > > >Please clarify if you were making a lame joke without smilies, are >utterly confused about what "declaration" *MEANS*, or what other folly >prompted you to this astounding remark, t

Re: Vectors in Visual Python

2005-02-09 Thread Alex Martelli
Terry Reedy <[EMAIL PROTECTED]> wrote: > I (and I believe Alex) object to name declaration *statements* and/or the > strong typing of *names*. I confirm that my key objection is to declarations in the strict sense: thingies that aren't executable, but rather billets doux to the compiler, for exam

Re: Vectors in Visual Python

2005-02-09 Thread Alex Martelli
Arthur <[EMAIL PROTECTED]> wrote: > is that VPython "vectors" are in effect flat 3 element Numeric arrays, > and Numeric ararys can be constructed with Float64 specified as the > datatype. (wonder if that speciufication is a "declaration", and if > so whe

Re: Vectors in Visual Python

2005-02-09 Thread Terry Reedy
"Arthur" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > is that VPython "vectors" are in effect flat 3 element Numeric arrays, > and Numeric ararys can be constructed with Float64 specified as the > datatype. (wonder if that speciufication is a

Re: Vectors in Visual Python

2005-02-09 Thread Arthur
his be the source of the >error I am finding? If not what else could be the culprit? My understanding: is that VPython "vectors" are in effect flat 3 element Numeric arrays, and Numeric ararys can be constructed with Float64 specified as the datatype. (wonder if that speciuficatio

Vectors in Visual Python

2005-02-09 Thread FLChamp
SOrry if this message is a little confused, it most probably reflects the state of the author! I have made a small program that plots the orbit of a planet in visual python using visual.vector for all values. If i run the program it is clear that the orbit is non-keplerian as the planets gradually