The regex parser fails to recognize in expressions such as *1/(4x-1)*, that 
4x is 4 times x.

I tried to call *M("1/(4x - 1)")* and I got the following transformation:

Integer (1 )/(Integer (4 )Symbol ('x' )-Integer (1 ))

Obviously, Integer(4) Symbol('x') is not valid, as an asterisk (*) is 
missing to represent the multiplication.

A quick makeshift fix:

your_mathematica_expr = '((-2x+5)(4x-1)-4(-x^2+5x+1))/(4x-1)^2'
new_math_expr = re.sub("([0-9])\ *([a-zA-Z])", "\\1 * \\2", 
your_mathematica_expr)
M(new_math_expr)



On Thursday, November 27, 2014 1:42:53 PM UTC+1, Lee Philip wrote:
>
> test code here, error encountered there .
>
> http://codepad.org/hZEmO4Po
>
> what I want to do here is just convert it to a Python acceptable 
> expression ,is there an easy way ?
>

-- 
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/33d69e97-64d4-4e86-9cc4-a263ad49c941%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to