Re: [Numpy-discussion] Characteristic of a Matrix.

2015-01-08 Thread Ryan Nelson
Colin,

I'll second the endorsement of Sage; however, for teaching purposes, I
would suggest Sage Math Cloud. It is a free, web-based version of Sage, and
it does not require you or the students to install any software (besides a
new-ish web browser). It also make sharing/collaborative work quite easy as
well. I've used this a bit for demos, and it's great. The author William
Stein is good at correcting bugs/issues very quickly.

Sage implements it's own Matrix and Vector classes, and the Vector class
has a "column" method that returns a column vector (transpose).
http://www.sagemath.org/doc/tutorial/tour_linalg.html

For what it's worth, I agree with others about the benefits of avoiding a
Matrix class in Numpy. In my experience, it certainly makes things cleaner
in larger projects when I always use NDArray and just call the appropriate
linear algebra functions (e.g. np.dot, etc) when that is context I need.

Anyway, just my two cents.

Ryan

On Wed, Jan 7, 2015 at 2:44 PM, cjw  wrote:

>  Thanks Alexander,
>
> I'll look at Sage.
>
> Colin W.
>
>
> On 06-Jan-15 8:38 PM, Alexander Belopolsky wrote:
>
> On Tue, Jan 6, 2015 at 8:20 PM, Nathaniel Smith  
>  wrote:
>
>
>  Since matrices are now part of some high school curricula, I urge that
>
>  they
>
>  be treated appropriately in Numpy.  Further, I suggest that
>
>  consideration be
>
>  given to establishing V and VT sub-classes, to cover vectors and
>
>  transposed
>
>  vectors.
>
>  The numpy devs don't really have the interest or the skills to create
> a great library for pedagogical use in high schools. If you're
> interested in an interface like this, then I'd suggest creating a new
> package focused specifically on that (which might use numpy
> internally). There's really no advantage in glomming this into numpy
> proper.
>
>
> Sorry for taking this further off-topic, but I recently discovered an
> excellent SAGE package,  
> .  While it's targeted
> audience includes math graduate students and research mathematicians, parts
> of it are accessible to schoolchildren.  SAGE is written in Python and
> integrates a number of packages including numpy.
>
> I would highly recommend to anyone interested in using Python for education
> to take a look at SAGE.
>
>
>
>
> ___
> NumPy-Discussion mailing 
> listNumPy-Discussion@scipy.orghttp://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Build doesn't pass tests

2015-01-08 Thread Nikolay Mayorov
Hi all! 
I'm trying to build numpy on Windows 64 bit, Python 3.4.2 64 bit.  
I do environment setup by the following command:
CMD /K "SET MSSdk=1 && SET DISTUTILS_USE_SDK=1 && "C:\Program Files 
(x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64"
Then I cd to the newly cloned numpy folder and do: python setup.py build_ext 
--inplace 
It looks like the build process finishes correctly. 
But then python -c "import numpy; numpy.test()" crashes the interpreter (some 
tests pass before the crash). I found out that it is caused by numpy.fromfile 
function call.
What might be the reason of that? Do I use wrong msvc compiler? 
  ___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Characteristic of a Matrix.

2015-01-08 Thread Nathaniel Smith
On Wed, Jan 7, 2015 at 7:35 PM, cjw  wrote:
> Nathaniel,
>
> Of the two characteristics to which I pointed, I feel that the
> rectangularity check is the more important.  I gave an example of a typo
> which demonstrated this problem.

The numpy matrix class does require rectangularity; the issue you ran
into is more weird than that. It's legal to make a matrix of arbitrary
python objects, e.g.

np.matrix([["hello", None]])

(this can be useful e.g. if you want to work with extremely large
integers using Python's long integer objects).

In your case, b/c the lists were not the same length, the matrix
constructor guessed that you wanted a matrix containing two Python
list objects. This is pretty confusing, and fixing it is bug #5303.
But it doesn't indicate any deeper problem with the matrix object.
Notice:

In [5]: A2 = np.matrix([[1, 2, -2], [-3, -1, 4], [4, 2 -6]])

In [6]: A2.shape
Out[6]: (1, 3)

In [7]: A2[0, 0]
Out[7]: [1, 2, -2]

> The error message reported that pinv does not have a conjugate function
> which, I suggest, is a totally misleading error message.

When working with arrays/matrices of objects, functions like 'pinv'
will try to call special methods on the objects. This is a little
weird and arguably a bug itself, but it does mean that it's at least
possible in theory to have an array of arbitrary python objects and
have pinv() work. Of course this requires objects that will cooperate.
In this case, though, pinv() has no idea what to do with a matrix
whose elements are themselves lists, so it gives an error.

-n

-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Build doesn't pass tests

2015-01-08 Thread Julian Taylor
On 01/08/2015 07:31 PM, Nikolay Mayorov wrote:
> Hi all! 
> 
> I'm trying to build numpy on Windows 64 bit, Python 3.4.2 64 bit.  
> 
> I do environment setup by the following command:
> 
> CMD /K "SET MSSdk=1 && SET DISTUTILS_USE_SDK=1 && "C:\Program Files
> (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64"
> 
> Then I cd to the newly cloned numpy folder and do: python setup.py
> build_ext --inplace 
> 
> It looks like the build process finishes correctly. 
> 
> But then python -c "import numpy; numpy.test()" crashes the interpreter
> (some tests pass before the crash). I found out that it is caused by
> numpy.fromfile function call.
> 
> What might be the reason of that? Do I use wrong msvc compiler?
> 
> 

I think compiling python3 extensions requires VS 2010, python 2
extensions VS2008.
A crash in a fromfile test is what I would expect from using the wrong
compiler.

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion