Re: [Tutor] Numpy documentation
Hi Roger, My comments below, below yours. On Thu, Oct 04, 2018 at 12:02:01PM -0700, Roger Lea Scherer wrote: [...] > In the example pictured below, the array has 2 axes. The first axis has a > length of 2, the second axis has a length of 3. > [[ 1., 0., 0.], > [ 0., 1., 2.]] > > (I think) I understand the 2 axes. [1,0,0] (I'm lazy and don't want to type > the periods) is one axis and [0,1,2] is the second axis. You can copy and paste text to avoid extra typing. You seem to be are thinking along the lines of axles in a car, where the two axles run parallel: Axle one: - Axle two: - You should think of axes of a graph, which run perpendicular to each other, like the lines of a plus sign + or cross. So the array: [[ 1., 0., 0.], [ 0., 1., 2.]] is two dimensional, with 2 rows and 3 columns. In mathematics, we would call it a 2x3 matrix; in programming, it would be a 2x3 array. Axis one (rows): length 2 Axis two (columns): length 3 Regards, -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Numpy documentation
On 04/10/18 20:02, Roger Lea Scherer wrote: > In the example pictured below, the array has 2 axes. The first axis has a > length of 2, the second axis has a length of 3. > [[ 1., 0., 0.], > [ 0., 1., 2.]] > > (I think) I understand the 2 axes. [1,0,0] (I'm lazy and don't want to type > the periods) is one axis and [0,1,2] is the second axis. Nope. Its the other way round. The first axis is the "column" of two rows. Hence length 2. The second axis is the row with 3 elements in each. If you look at it as a table you can access the elements using x,y coordinates. The x coordinate (being first) denotes which row is indicated and the y axis being second denotes the element within the row. > ...But why does the first axis have a length of 2? Because there are two rows. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Numpy documentation
I truly don't think I'm this stupid, but I can't even understand the fourth paragraph of the numpy documentation. https://docs.scipy.org/doc/numpy/user/quickstart.html says: In the example pictured below, the array has 2 axes. The first axis has a length of 2, the second axis has a length of 3. [[ 1., 0., 0.], [ 0., 1., 2.]] (I think) I understand the 2 axes. [1,0,0] (I'm lazy and don't want to type the periods) is one axis and [0,1,2] is the second axis. But then things get goofy. The first axis has a length of 2. Is that because [1,0,0] and [0,1,2] are counted as one axis? (I think) I understand the second axis has a length of 3 because there are 3 elements within the [0,1,2] axis. Is that correct? But why does the first axis have a length of 2? Because the second zero doesn't count? Did they change the example and forgot to change the text? Thank you for your help as always. -- Roger Lea Scherer 623.255.7719 *Strengths:* Input, Strategic, Responsibility, Learner, Ideation ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor