SymPy Gamma is essentially SymPy’s clone of Wolfram|Alpha, at least in terms of math features. We just rolled out some new features:

Gamma’s (and by extension, SymPy’s) parsing still needs work, though, when it comes to the implicit style. Consider, for instance, the input y(x). Is this

  1. The function \(\mathrm{y}(x)\), or
  2. The product \(yx\)?

This makes inputs ambiguous, at least to the parser. For instance, it makes sense that expand(a(x + 1) + b(x + 2)) should be \(ax + bx + a + b\) and not $\mathrm{a}(x+1) + \mathrm{b}(x+2)$. Meanwhile, rsolve(y(n+2) - y(n+1) - y(n), y(n)) wouldn’t make any sense as \(\mathrm{rsolve}(ny + 2y - ny - y - ny, ny)\).

How do we solve this problem? I see three, non-mutually-exclusive ways:

  1. Provide an “interpret as” functionality, like Wolfram|Alpha. For functions, you can also explicitly specify a function symbol with Function("f")(x), though this is rather tedious to type.
  2. Give the parser a whitelist/blacklist of functions to use implicit function or implicit multiplication syntax.
  3. Try it both ways and take the one that doesn’t raise an exception.

So in the future, I’d like to improve SymPy’s parser more – and hopefully, someday add natural language parsing to Gamma. Dealing with these ambiguities is a first step towards that.