News for hackers. Stuff that matters.
Re:GNU Octave by sampo on Saturday November 19, 2016 @02:06PM (#12995025)
Just to illustrate:

Octave:

    m = [0 1 0; 0 0 1; 1 0 0]
    v = [2 3 1]'
    m\v
    
    ans =
    
       1
       2
       3
Python:

    import numpy as np
    m = np.array([[0,1,0],[0,0,1],[1,0,0]])
    v = np.transpose(np.array([2,3,1]))
    # wtf? oh, I guess then
    v = np.transpose(np.array([[2,3,1]]))
    np.linalg.solve(m,v)
    
    array([[ 1.],
           [ 2.],
           [ 3.]])
If you just want to play around, Python has more clutter and gotchas.

Of course, when you start to write real software, then the tools that Python provides for organizing your code start to weight more and the clumsiness of np.linalg.solve(m,v) over m\v starts to weight less.

But I can see how a 50-line testing script in Octave organically grows to a 2000-line application, and then it's already a lot of work to rewrite in Python.

Edit: a reply below makes a good point simplifying the Python code a little bit.

Re:GNU Octave by messe on Saturday November 19, 2016 @02:27PM (#12995146)
What's wrong with:

    >>> import numpy as np
    >>> m = np.array([[0,1,0],[0,0,1],[1,0,0]])
    >>> v = np.array([2,3,1])
    >>> np.linalg.solve(m,v)

    array([ 1.,  2.,  3.])
No need to transpose, as numpy handles row and column vectors identically. Using the above variables `m` and `v`:

    >>> v @ m   # treated as row vector
    array([1, 2, 3])

    >>> m @ v   # treated as column vector
    array([3, 1, 2])
Where `@`, for those who don't know, is the matrix multiplication operator (`np.dot`) introduced in recent versions of python 3.
Re:GNU Octave by noobermin on Saturday November 19, 2016 @04:13PM (#12995707)
Sounds like a case of familiarity being confused for ease of use.
Re:GNU Octave by TheSpiceIsLife on Saturday November 19, 2016 @04:14PM (#12995714)
What's wrong with .... introduced in recent versions of python 3.

Exactly.

Re:GNU Octave by foota on Saturday November 19, 2016 @08:07PM (#12996691)
Python3 is ancient, can we stop pretending otherwise?
Re:GNU Octave by TAForObvReasons on Sunday November 20, 2016 @12:14AM (#12997379)
PEP 465 introduced the infix operator @: https://www.python.org/dev/peps/pep-0465/

Python 3.5 was the first version of python3 to implement the PEP: https://docs.python.org/3.5/whatsnew/3.5.html

If I am reading the release notes correctly, Python 3.5.0 was released last year (2015-09-13): https://www.python.org/downloads/release/python-350/

It's fair to say that this is a relatively new development.

Re:GNU Octave by foota on Sunday November 20, 2016 @03:10AM (#12997854)
It's true that infix multiply is new, but infix multiply if I'm not mistaken is not a breaking change.
Re:GNU Octave by TheSpiceIsLife on Sunday November 20, 2016 @02:11AM (#12997724)
True.

I mean in the context as @sampo described it above ...

In the Stanford/Coursera machine learning class, Andrew Ng said that his teaching experience is that students pick up octave/matlab quicker and the course can cover more actual machine learning, compared to python where more time is spent learning the language.

Then "which version of Python, and how is that different..." etc.

Re:GNU Octave by jjawssd on Sunday November 20, 2016 @01:48PM (#13000379)
Code targeting Python 3.2 which was released five years code is still compatible with the latest versions of Python 3. What is the issue exactly?
Re:GNU Octave by collinmanderson on Wednesday November 23, 2016 @09:24AM (#13022812)
There are still hundreds of projects that need to get ported to 3.x. http://portingdb.xyz
Re:GNU Octave by collinmanderson on Friday December 02, 2016 @12:22PM (#13090448)
That link above seems to have broken. Here's an alternative link: https://portingdb-encukou.rhcloud.com/
Re:GNU Octave by tombone12 on Saturday November 19, 2016 @02:15PM (#12995082)
Why not just: v = np.array([2,3,1]).T

is there something wrong with numpys convenience method for transpose but not matlabs postfix unary convenience operator?

Re:GNU Octave by sampo on Saturday November 19, 2016 @02:20PM (#12995117)
You are right, T would be nicer than np.tranpose. But the first google hit on 'numpy transpose' [1] doesn't give that as as example.

Also you too made the same mistake: np.array([2,3,1]).T doesn't do anything, you need np.array([[2,3,1]]).T

[1] https://docs.scipy.org/doc/numpy/reference/generated/numpy.t...

Re:GNU Octave by brudgers on Saturday November 19, 2016 @02:31PM (#12995167)
I think that's kindasorta of reason for Ng's preference: students will focus on the subject of machine learning and not spend time on the ins and outs of Python and Numpy (or these days TensorFlow). It's the same sort of pedagogical approach that keeps SML as an active teaching language.

When someone googles Matlab/Octave there won't be the same mixture of contexts as there is for Python. With Python there's "2 or 3?" before even starting. Than Cython or Jython or PyPy? That's nothing against Python except that in one particular time limited context, the questions are a distraction {without even considering the complaints of students when the choice of Python implementation is contrary to their opinion}.

Re:GNU Octave by hasch on Saturday November 19, 2016 @05:49PM (#12996173)
here is sagemath

    m = matrix([[0, 1, 0],
                [0, 0, 1],
                [1, 0, 0]])
    v = vector([2, 3, 1])
    m \ v
(1, 2, 3)

and then

    sol = m \ v
    m * sol
(2, 3, 1)
Re:GNU Octave by akavel on Saturday November 19, 2016 @02:17PM (#12995103)
How about Julia and R?
Re:GNU Octave by em500 on Saturday November 19, 2016 @03:13PM (#12995358)
R:

    m = matrix( c(0,0,1,1,0,0,0,1,0), nrow=3 )
    v = c(2,3,1)
    solve(m,v)

    [1] 1 2 3

Julia: for this code snippet the syntax is identical to Matlab:

    m = [0 1 0; 0 0 1; 1 0 0]
    v = [2 3 1]'
    m\v

    3×1 Array{Float64,2}:
    1.0
    2.0
    3.0