Ich muss sicherstellen, dass f, a, c und p positive Zahlen sind, so dass der Ausgang nur positiv ist.Weisen Sie der Variablen einen positiven Wert zu
import sympy
f,c,a,p,v = sympy.symbols('f c a p v')
expr = p*a*c*v**2 - 2*f
print(sympy.solve(expr, 'v'))
Verwenden Sie Magie von 'if'! – Arman
Sie sind keine Zahlen, positiv oder negativ; Sie sind Symbole. Das Ergebnis von "lösen" ist einfach ein Ausdruck, der für "v" gelöst ist. – chepner
Check it out: http://stackoverflow.com/questions/7122535/python-ensuring-a-variable-holds-a-positive-number – TheInvisibleMan