The parser was fixed as indicated at
http://stackoverflow.com/questions/26249993/6x2-x-72x33x2-2x-5-as-input-in-sympy
>>> from sympy.parsing.mathematica import mathematica as m
>>> m('(-6 * x**2 - x - 7) * (2 * x**3 + 3 * x**2 - 2 * x - 5)')
(-6*x**2 - x - 7)*(2*x**3 + 3*x**2 - 2*x - 5)
>>> _.diff(x)
(-12*x - 1)*(2*x**3 + 3*x**2 - 2*x - 5) + (-6*x**2 - x - 7)*(6*x**2 + 6*x -
2)
On Wednesday, October 8, 2014 8:42:16 AM UTC-5, Mateusz Paprocki wrote:
>
> Hi,
>
> On 8 October 2014 12:05, <[email protected] <javascript:>> wrote:
> > Is there any function in SymPy can take this TEX command as an input
> >
> > (-6x^2-x-7)(2x^3+3x^2-2x-5)
> >
> > to find the derivative?
>
> I wanted to suggest a mathematica parser for this:
>
> In [1]: import sympy.parsing.mathematica as m
>
> In [2]: m.parse("(-6x^2-x-7)(2x^3+3x^2-2x-5)")
> Out[2]: '(-6*x**2-x-7)*(2*x**3+3*x**2-2*x-5)'
>
> In [3]: eval(_)
> Out[3]:
> ⎛ 2 ⎞ ⎛ 3 2 ⎞
> ⎝- 6⋅x - x - 7⎠⋅⎝2⋅x + 3⋅x - 2⋅x - 5⎠
>
> But there is bug there and the above output requires the following patch:
>
> diff --git a/sympy/parsing/mathematica.py b/sympy/parsing/mathematica.py
> index f86d59a..eeb12f7 100644
> --- a/sympy/parsing/mathematica.py
> +++ b/sympy/parsing/mathematica.py
> @@ -39,7 +39,7 @@ def parse(s):
> (r"\A\((.+)\)([\w\.].*)\Z", # Implied multiplication - (a)b
> lambda m: "(" + parse(m.group(1)) + ")*" + parse(m.group(2))),
>
> - (r"\A([\d\.]+)([a-zA-Z].*)\Z", # Implied multiplicatin - 2a
> + (r"\A([+-]?[\d\.]+)([a-zA-Z].*)\Z", # Implied multiplicatin - 2a
> lambda m: parse(m.group(1)) + "*" + parse(m.group(2))),
>
> (r"\A([^=]+)([\^\-\*/\+=]=?)(.+)\Z", # Infix operator
>
> Mateusz
>
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "sympy" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > Visit this group at http://groups.google.com/group/sympy.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/sympy/04e0cbd4-5b6b-4418-8166-024a0729aff8%40googlegroups.com.
>
>
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/94765cae-9366-4e3c-a64c-d7694104f038%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.