Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Kudos to Wolfram for this.

I do wonder how much pressure they're feeling from the likes of IPython these days and if that was a motivating factor.

The other part is I don't think I've met a regular Mathematica user that actually likes it, so this may turn out to be a bad idea!



I've used Mathematica for 24 years now, and I quite like it. It was especially helpful when I was in school, for working on my homework. The fact that it could do symbolic calculus, and do algebra without making any mistakes helped a ton. These sorts of problems....

    In[1]:= D[x^2 Sin[x], x]
    Out[1]= x^2 Cos[x] + 2 x Sin[x]

    In[8]:= Integrate[Sin[x], {x, 0, c}]
    Out[8]= 1 - Cos[c]

    In[10]:= Solve[{x + 23 y + x^2 == 46, x - y == 234}, {x, y}]
    Out[10]= {{x -> 2 (-6 - Sqrt[1393]), y -> 2 (-123 - Sqrt[1393])}, 
              {x -> 2 (-6 + Sqrt[1393]), y -> 2 (-123 + Sqrt[1393])}}
I love ipython as well, but it can't do that sort of thing.


> I love ipython as well, but it can't do that sort of thing.

I love the amount of investigation people put into this sort of thing before making blanket statements like this.

    >>> diff ( x**2 * sin ( x ) , x )
     2
    x *cos(x) + 2*x*sin(x)

    >>> integrate ( sin ( x ) , ( x , 0 , c ) )
    -cos(c) + 1

    >>> solve ( [ Eq ( x + 23 * y + x**2 , 46 ) , Eq ( x - y , 234 ) ] )
                   ______                ______
    [{x: -12 + 2*\/ 1393 , y: -246 + 2*\/ 1393 },
              ______                    ______
    {x: - 2*\/ 1393 - 12, y: -246 - 2*\/ 1393 }]
Try it for yourself: http://live.sympy.org/

I am no sympy expert at all - I figured it all out in the time since I read your comment. But of course I'm sure you love ipython as well.

(edit - fixed copy&pasting stupidness)


Thanks for pointing out sympy, I hadn't heard of it. I'm not sure why you're being sarcastic, I basically write python code full time. I'm quite familar with it, so I felt qualified to comment without doing any 'investigation'. I use ipython with the normal numpy/matplotlib/scipy numerical approach. You knew something I didn't, congratulations.


How does writing python qualify you to pose things you don't know are true as facts?


It qualifies me to talk about the python ecosystem, which I know quite well. I said something I thought was true, but wasn't. That's an honest mistake. I was unaware of a library, maybe even one that is well known. I was quite surprised I had missed something, and I said 'thanks for pointing that out'. I imagine it was a blind spot for me, as I always reach for Mathematica for symbolic work, so it just wasn't something I noticed.

I would never say things about ruby libraries, for example, as I don't know anything about it. I might say the same thing about R or matlab, which I do.

In the immortal words of pg:

    When disagreeing, please reply to the argument instead of calling names. 
    E.g. "That is an idiotic thing to say; 1 + 1 is 2, not 3" 
    can be shortened to "1 + 1 is 2, not 3." 
As in, 'python actually can do symbolic computation, see http://sympy.org'

'Oh, thanks. You're right'


I'm not blaming you for being wrong. I just don't think that having a good idea about the python ecosystem qualifies denying that you can do symbolic calculus, more than knowing how to sail qualifies you to say that the earth is flat.


Sorry I just thought it was impossible to not know about the whole python math stack being an actual ipython user, so assumed you were just paying lip service.



IPython is great system for interactive programming, especially for someone who is familiar with Python and is able to find a complete distribution or able to set up all the details about their distribution (e.g. avoid problems like https://news.ycombinator.com/item?id=6725597), or someone who requires free-as-in-speech software.

I don't use either IPython or Mathematica much, but I would understand preferring Mathematica over IPython given the choice. Aside from being younger, IPython is made of a combination of systems without a strong conceptual glue tying them together. Mathematica is made of a combination of systems too (kernel written in C, various external libraries in C, Lucene search engine, etc), but the components are tied together using what I guess is now called the Wolfram language, where everything, from computations to settings to notebooks themselves, is specified in Wolfram language expressions. If you view an IPython file in a text editor you see JSON, which is different than the language used to compute. If you open a Mathematica notebook in a text editor you see a nested set of Wolfram language expressions. Mathematica grew up around that idea.

As a further small example, compare the prompts to the two systems:

  IPython
  In [1]: 1+2
  Out[1]: 3
vs

  Mathematica
  In[1]:= 1+2
  Out[1]= 3
In IPython, the array brackets are just a sort of notation--the assignment isn't syntactially correct Python. But in Mathematica, you can view that prompt as assigning the value of an In list at index 1 the expression "1+2".

That sort of consistency holds through the entire system in a way that IPython can't match.


I am not sure if you are aware of this, but you can access the history of IPython inputs and outputs through the two arrays `In` and `Out`. This prompt is precisely indicating this.


Thank you for pointing that out. I meant to show that while they both store their inputs and outputs in array-like structures, Mathematica does it in a way that is valid in its own syntax, and IPython does not.

In Mathematica "In[1]:= 1+2" is a syntactially valid expression (though the literal In symbol is protected), so you could do the following:

  In[1]:= in[1]:= 1+2
and the interpreter would evaluate it (though the values of In[1] and in[1] would be different).

But even with all of the symbols defined, this is not valid Python (according to https://www.pythonanywhere.com/try-ipython/):

  In [1]: in=[]
                                                                                             
  In [2]: in[0]:1+2                                                                        
    File "<ipython-input-2-b9cd4c9ee15d>", line 1
      in[0]:1+2
           ^
  SyntaxError: invalid syntax
The fact that this trivial expression is valid in Mathematica and not in IPython by itself says nothing about the relative merits of each system. IPython could be modified to use another notation for the input/output arrays, and Mathematica would work just as well if it were changed to use some syntactically incorrect notation. But what I was attempting to show is an example of how consistent Mathematica is.


>the assignment isn't syntactially correct Python.

It is.


wat


Mathematica to me is like Perl. You don't necessarily like it, but it is often the tool that gets the job done in a minimum amount of time, with spectacular results.


Student versions of Mathematica are also pretty cheap; that's rather just a vendor lock-in attempt (;


I think SageMath might be closer in spirit to Mathematica, but SageMath uses IPython a bit under the hood.


What does "SageMath uses IPython a bit under the hood" ????

To Quote Sage's home page: "Sage is a free open-source mathematics software system licensed under the GPL. It combines the power of many existing open-source packages into a common Python-based interface."

Sage is based on Python and so it is not a bit it is the whole thing.


Python, yes. IPython, I'm not sure the extent which it's used.


The interactive command line shell of Sage is IPython.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: