I tryed the same expressions on sympy online and it worked, so I don't 
think it is a specific expressions issue, but I can be wrong of course. 
Online I tryed without sympify 'cause I wanted to try if it was just a 
specific error as you said. 

I post my code if it can help:

#!/usr/bin/env python
from sympy import Symbol, sympify
from sympy import *
from mpmath import *

from sympy.solvers import linsolve
import re

var = {"m1": 1, "m2": 2, "v1i": 3, "v1f": 4, "v2i": '', "v2f": ''}

c = 0
unk = []
x, y = 0, 0
for key, val in var.items():
  if val == '':
      c+=1
      if x==0:
          x = key
          unk.append(x)
          x = symbols(key, real=True)

        elif y==0:
          y=key
          unk.append(y)
          y = symbols(key, real=True)
      else:
          break

if c>2:
  print("Mi spiace non posso calcolare i dati mancanti. Contatta 
l'amministratore se sei sicuro dei dati inseriti!")

else:

    system = ["m1 * v1i + m2 * v2i - m1 * v1f - m2 * v2f",
            "m1 * v1i * v1i / 2 + m2 * v2i * v2i / 2 - m1 * v1f * v1f / 2 - 
m2 * v2f * v2f / 2"]

    for key, val in var.items():
      if not val == '':
          for i in range(len(system)):
              system[i] = system[i].replace(key, str(val))
  print(system)

    eq = sympify(system)
  system = nonlinsolve(eq, [x, y])
  print(system)


-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/cf2deff0-6361-4871-a896-73ca164f02e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to