Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-22 Thread Anne Archibald
2009/12/21 David Goldsmith : > On Mon, Dec 21, 2009 at 9:57 AM, Christopher Barker > wrote: >> Dag Sverre Seljebotn wrote: >>> I recently got motivated to get better linear algebra for Python; >> >> wonderful! >> >>> To me that seems like the ideal way to split up code -- let NumPy/SciPy >>> deal

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-22 Thread David Goldsmith
On Tue, Dec 22, 2009 at 1:06 AM, Dag Sverre Seljebotn wrote: > > OK. As a digression, I think it is easy to get the wrong impression of > Sage that it is for "symbolics" vs. "computations". The reality is that > the symbolics has been one of the *weaker* aspects of Sage (though > steadily improvin

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-22 Thread Dag Sverre Seljebotn
Christopher Barker wrote: > Dag Sverre Seljebotn wrote: >> This is readily done -- there is no computational portion except for >> what is in NumPy/Scipy or scikits, and I intend for it to remain that >> way. It's just another interface, really. >> >> (What kind of computations were you thinking

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-21 Thread Christopher Barker
Dag Sverre Seljebotn wrote: > This is readily done -- there is no computational portion except for > what is in NumPy/Scipy or scikits, and I intend for it to remain that > way. It's just another interface, really. > > (What kind of computations were you thinking about?) Nothing in particular -

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-21 Thread David Goldsmith
On Mon, Dec 21, 2009 at 1:31 PM, Dag Sverre Seljebotn wrote: > > Yes, I'm going my own way with it -- the SciPy matrix discussion tends > to focus on cosmetics IMO, and I just tend to fundamentally disagree > with the direction these discussions take on the SciPy/NumPy lists. > What I'm after is n

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-21 Thread Dag Sverre Seljebotn
Christopher Barker wrote: > Dag Sverre Seljebotn wrote: >> I recently got motivated to get better linear algebra for Python; > > wonderful! > >> To me that seems like the ideal way to split up code -- let NumPy/SciPy >> deal with the array-oriented world and Sage the closer-to-mathematics >> no

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-21 Thread Dag Sverre Seljebotn
Christopher Barker wrote: > Dag Sverre Seljebotn wrote: >> I recently got motivated to get better linear algebra for Python; > > wonderful! > >> To me that seems like the ideal way to split up code -- let NumPy/SciPy >> deal with the array-oriented world and Sage the closer-to-mathematics >> no

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-21 Thread David Goldsmith
On Mon, Dec 21, 2009 at 9:57 AM, Christopher Barker wrote: > Dag Sverre Seljebotn wrote: >> I recently got motivated to get better linear algebra for Python; > > wonderful! > >> To me that seems like the ideal way to split up code -- let NumPy/SciPy >> deal with the array-oriented world and Sage t

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-21 Thread Christopher Barker
Dag Sverre Seljebotn wrote: > I recently got motivated to get better linear algebra for Python; wonderful! > To me that seems like the ideal way to split up code -- let NumPy/SciPy > deal with the array-oriented world and Sage the closer-to-mathematics > notation. well, maybe -- but there is a

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread David Goldsmith
I think the "bottom line" is: _only_ use the matrix class if _all_ you're doing is matrix algebra - which, as Chris Barker said, is (likely) the exception, not the rule, for most numpy users. I feel confident in saying this (that is, _only_ ... _all_) because if you feel you really must have a mat

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Dag Sverre Seljebotn
Christopher Barker wrote: > Wayne Watson wrote: > >> Yes, flat sounds useful here. However, numpy isn't bending over >> backwards to tie in conventional mathematical language into it. >> > > exactly -- it isn't bending over at all! (well a little -- see below). > numpy was designed for ge

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Charles R Harris
On Sat, Dec 19, 2009 at 11:50 AM, Wayne Watson wrote: > I guess I'll become accustomed to it over time. I have some interesting > things to do for which I will need the facilities of numpy. > > I realized where I got into trouble with some of this. I was not > differentiating between the dimensio

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Wayne Watson
I guess I'll become accustomed to it over time. I have some interesting things to do for which I will need the facilities of numpy. I realized where I got into trouble with some of this. I was not differentiating between the dimensionality of space and that of a matrix or array. I haven't had t

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Christopher Barker
Wayne Watson wrote: > Yes, flat sounds useful here. However, numpy isn't bending over > backwards to tie in conventional mathematical language into it. exactly -- it isn't bending over at all! (well a little -- see below). numpy was designed for general purpose computational needs, not any one

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Wayne Watson
That's for sure! :-) Charles R Harris wrote: > > > On Sat, Dec 19, 2009 at 10:38 AM, Wayne Watson > mailto:sierra_mtnv...@sbcglobal.net>> > wrote: > > Yes, flat sounds useful here. However, numpy isn't bending over > backwards to tie in conventional mathematical language into it. > I

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Wayne Watson
OK, so what's your recommendation on the code I wrote? Use shape 0xN? Will that eliminate the need for T? I'll go back to Tenative Python, and re-read dimension, shape and the like. Charles R Harris wrote: > > > On Sat, Dec 19, 2009 at 9:45 AM, Wayne Watson > mailto:sierra_mtnv...@sbcglobal.ne

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Charles R Harris
On Sat, Dec 19, 2009 at 10:38 AM, Wayne Watson wrote: > Yes, flat sounds useful here. However, numpy isn't bending over > backwards to tie in conventional mathematical language into it. > I don't recall flat in any calculus books. :-) Maybe I've been away so > long from it, that it is a common ma

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Wayne Watson
Yes, flat sounds useful here. However, numpy isn't bending over backwards to tie in conventional mathematical language into it. I don't recall flat in any calculus books. :-) Maybe I've been away so long from it, that it is a common math concept? Although I doubt that. Alan G Isaac wrote: > On

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Charles R Harris
On Sat, Dec 19, 2009 at 9:45 AM, Wayne Watson wrote: > > > Dag Sverre Seljebotn wrote: > > Wayne Watson wrote: > > > >> I'm trying to compute the angle between two vectors in three dimensional > >> space. For that, I need to use the "scalar (dot) product" , according to > >> a calculus book (quoti

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Alan G Isaac
On 12/19/2009 11:45 AM, Wayne Watson wrote: > A 4x1, 1x7, and 1x5 would be examples of a 1D array or matrix, right? > > Are you saying that instead of using a rotational matrix ... > that I should use a 2-D array for rotCW? So why does numpy have a matrix > class? Is the class only used when work

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Wayne Watson
Dag Sverre Seljebotn wrote: > Wayne Watson wrote: > >> I'm trying to compute the angle between two vectors in three dimensional >> space. For that, I need to use the "scalar (dot) product" , according to >> a calculus book (quoting the book) I'm holding in my hands right now. >> I've used d

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Dag Sverre Seljebotn
Wayne Watson wrote: > I'm trying to compute the angle between two vectors in three dimensional > space. For that, I need to use the "scalar (dot) product" , according to > a calculus book (quoting the book) I'm holding in my hands right now. > I've used dot() successfully to produce the necessar

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-19 Thread Wayne Watson
I'm trying to compute the angle between two vectors in three dimensional space. For that, I need to use the "scalar (dot) product" , according to a calculus book (quoting the book) I'm holding in my hands right now. I've used dot() successfully to produce the necessary angle. My program works j

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread David Goldsmith
np.dot(x.flat, x.flat) _is exactly_ "sum of squares"(x.flat). Your math education appears to have drawn a distinction between "dot product" and "scalar product," that, when one is talking about Euclidean vectors, just isn't there: in that context, they are one and the same thing. DG On Fri, Dec

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
I'll amend that. I should have said, "Dot's all folks." -- Bugs Bunny -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Nicely done. Alan G Isaac wrote: > On 12/18/2009 7:12 PM, Wayne Watson wrote: > >> The point of the scalar product is to produce theta. >> > > As David said, that is just NumPy's `dot`. > > a = np.array([0,2]) b = np.array([5,0]) theta = np.arccos(np.dot(a,b)/np.sqrt(np.d

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Alan G Isaac
On 12/18/2009 7:12 PM, Wayne Watson wrote: > The point of the scalar product is to produce theta. As David said, that is just NumPy's `dot`. >>> a = np.array([0,2]) >>> b = np.array([5,0]) >>> theta = np.arccos(np.dot(a,b)/np.sqrt(np.dot(a,a)*np.dot(b,b))) >>> theta 1.5707963267948966 >>> theta/n

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Alan G Isaac
On 12/18/2009 5:54 PM, Keith Goodman wrote: > On Fri, Dec 18, 2009 at 2:51 PM, Wayne Watson > wrote: >> That should do it. Thanks. How do I get the scalar result by itself? > >>> np.dot(x.T,x)[0,0] > 14 > > or > >>> x = np.array([1,2,3]) >>> np.dot(x,x) > 14 or np.dot(x.flat,x.flat) fw

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Not quite. The point of the scalar product is to produce theta. My intended use is that found in calculus. Nevertheless, my question is how to produce the result in some set of functions that are close to minimal. I could finish this off by using the common definition found in a calculus book (

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread David Goldsmith
On Fri, Dec 18, 2009 at 3:40 PM, Wayne Watson wrote: > Well, they aren't quite the same. If a is the length of A, and b is the > length of B, then a*b = A dot B* cos (theta).  I'm still not familiar > enough with numpy or math to know if there's some function that will > produce a from A. It's eas

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Well, they aren't quite the same. If a is the length of A, and b is the length of B, then a*b = A dot B* cos (theta). I'm still not familiar enough with numpy or math to know if there's some function that will produce a from A. It's easy enough to do, a = A(0)**2 + ..., but I would like to thi

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Keith Goodman
On Fri, Dec 18, 2009 at 3:22 PM, Wayne Watson wrote: > Is there a scalar product in numpy? Isn't that the same thing as a dot product? np.dot doesn't do what you want? ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/ma

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Very good. Is there a scalar product in numpy? Keith Goodman wrote: > On Fri, Dec 18, 2009 at 2:51 PM, Wayne Watson > wrote: > >> That should do it. Thanks. How do I get the scalar result by itself? >> > > >>> np.dot(x.T,x)[0,0] >>> >14 > > or > > >>> x = np.array([1,2,3]

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Keith Goodman
On Fri, Dec 18, 2009 at 2:51 PM, Wayne Watson wrote: > That should do it. Thanks. How do I get the scalar result by itself? >> np.dot(x.T,x)[0,0] 14 or >> x = np.array([1,2,3]) >> np.dot(x,x) 14 ___ NumPy-Discussion mailing list NumPy-Discussion

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
That should do it. Thanks. How do I get the scalar result by itself? Keith Goodman wrote: > On Fri, Dec 18, 2009 at 1:51 PM, Wayne Watson > wrote: > >> Is it possible to calculate a dot product in numpy by either notation >> (a ^ b, where ^ is a possible notation) or calling a dot function >>

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Keith Goodman
On Fri, Dec 18, 2009 at 1:51 PM, Wayne Watson wrote: > Is it possible to calculate a dot product in numpy by either notation > (a ^ b, where ^ is a possible notation) or calling a dot function > (dot(a,b)? I'm trying to use a column matrix for both "vectors". > Perhaps, I need to somehow change th

[Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Is it possible to calculate a dot product in numpy by either notation (a ^ b, where ^ is a possible notation) or calling a dot function (dot(a,b)? I'm trying to use a column matrix for both "vectors". Perhaps, I need to somehow change them to arrays? -- Wayne Watson (Watson Adventu