Exemple #1
0
assert set(denominator(eqn, var)) == set(['(B-2)**2', '(B+C)'])
eqn = 'A = (B + 2)/C'
assert denominator(eqn, var) == ['C']
eqn = 'A = B/(C - 2)'
assert denominator(eqn, var) == ['(C - 2)']
eqn = 'A = (B*C/tan(B))'
assert denominator(eqn, var) == ['tan(B)']
eqn = 'A = (1 + 1/C)'
assert denominator(eqn, var) == ['C']
eqn = 'A = 4/(C*B)'
assert denominator(eqn, var) == ['(C*B)']
eqn = 'A = C*B'
assert denominator(eqn, var) == []

eqn = 'A = (B - 1/C)/(1 - (B*C))'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', 'B = 1/C'])
eqn = 'A = (B - 1/C)/(1 - sin(B*C))'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', '(1 - sin(B*C)) = 0'])
eqn = 'A = (B - 1/C)/(1 - (B*C)**2)'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', 'B = 1/C'])
eqn = 'A = (B - 1/C)/(4 - (B*C)**2)'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', 'B = 2/C'])
eqn = 'A = (B - 1/C)/(B - 1)**2'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', 'B = 1'])
eqn = 'A = B + 1'
assert _solve_zeros(eqn, var) == []

eqn = 'A**2 + B*(2 - C) < C*A'
var = list('ABC')
res = simplify(eqn, variables=var, target=list('CAB'), all=True)
#print('\n#####\n'.join(res))
assert set(denominator(eqn , var)) == set(['(B-2)**2', '(B+C)'])
eqn = 'A = (B + 2)/C'
assert denominator(eqn , var) == ['C']
eqn = 'A = B/(C - 2)'
assert denominator(eqn , var) == ['(C - 2)']
eqn = 'A = (B*C/tan(B))'
assert denominator(eqn , var) == ['tan(B)']
eqn = 'A = (1 + 1/C)'
assert denominator(eqn , var) == ['C']
eqn = 'A = 4/(C*B)'
assert denominator(eqn , var) == ['(C*B)']
eqn = 'A = C*B'
assert denominator(eqn , var) == []

eqn = 'A = (B - 1/C)/(1 - (B*C))'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', 'B = 1/C'])
eqn = 'A = (B - 1/C)/(1 - sin(B*C))'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', '(1 - sin(B*C)) = 0'])
eqn = 'A = (B - 1/C)/(1 - (B*C)**2)'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', 'B = 1/C'])
eqn = 'A = (B - 1/C)/(4 - (B*C)**2)'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', 'B = 2/C'])
eqn = 'A = (B - 1/C)/(B - 1)**2'
assert set(_solve_zeros(eqn, var)) == set(['C = 0', 'B = 1'])
eqn = 'A = B + 1'
assert _solve_zeros(eqn, var) == []

eqn = 'A**2 + B*(2 - C) < C*A'
var = list('ABC')
res = simplify(eqn, variables=var, target=list('CAB'), all=True)
#print('\n#####\n'.join(res))
Exemple #3
0
assert _denominator(eqn, var) == ['(B-2)', '(B+C)']
eqn = 'A = (B + 2)/C'
assert _denominator(eqn, var) == ['C']
eqn = 'A = B/(C - 2)'
assert _denominator(eqn, var) == ['(C - 2)']
eqn = 'A = (B*C/tan(B))'
assert _denominator(eqn, var) == ['tan(B)']
eqn = 'A = (1 + 1/C)'
assert _denominator(eqn, var) == ['C']
eqn = 'A = 4/(C*B)'
assert _denominator(eqn, var) == ['(C*B)']
eqn = 'A = C*B'
assert _denominator(eqn, var) == []

eqn = 'A = (B - 1/C)/(1 - (B*C))'
assert _solve_zeros(eqn, var) == ['C = 0', 'B = 1/C']
eqn = 'A = (B - 1/C)/(1 - sin(B*C))'
assert _solve_zeros(eqn, var) == ['C = 0', '(1 - sin(B*C)) = 0']
eqn = 'A = (B - 1/C)/(1 - (B*C)**2)'
assert _solve_zeros(eqn, var) == ['C = 0', 'B = 1/C']
eqn = 'A = (B - 1/C)/(4 - (B*C)**2)'
assert _solve_zeros(eqn, var) == ['C = 0', 'B = 2/C']
eqn = 'A = (B - 1/C)/(B - 1)**2'
assert _solve_zeros(eqn, var) == ['C = 0', 'B = 1']
eqn = 'A = B + 1'
assert _solve_zeros(eqn, var) == []

eqn = 'A**2 + B*(2 - C) < C*A'
var = list('ABC')
res = simplify(eqn, variables=var, target=list('CAB'), all=True)
#print('\n#####\n'.join(res))
assert _denominator(eqn , var) == ['(B-2)', '(B+C)']
eqn = 'A = (B + 2)/C'
assert _denominator(eqn , var) == ['C']
eqn = 'A = B/(C - 2)'
assert _denominator(eqn , var) == ['(C - 2)']
eqn = 'A = (B*C/tan(B))'
assert _denominator(eqn , var) == ['tan(B)']
eqn = 'A = (1 + 1/C)'
assert _denominator(eqn , var) == ['C']
eqn = 'A = 4/(C*B)'
assert _denominator(eqn , var) == ['(C*B)']
eqn = 'A = C*B'
assert _denominator(eqn , var) == []

eqn = 'A = (B - 1/C)/(1 - (B*C))'
assert _solve_zeros(eqn, var) == ['C = 0', 'B = 1/C']
eqn = 'A = (B - 1/C)/(1 - sin(B*C))'
assert _solve_zeros(eqn, var) == ['C = 0', '(1 - sin(B*C)) = 0']
eqn = 'A = (B - 1/C)/(1 - (B*C)**2)'
assert _solve_zeros(eqn, var) == ['C = 0', 'B = 1/C']
eqn = 'A = (B - 1/C)/(4 - (B*C)**2)'
assert _solve_zeros(eqn, var) == ['C = 0', 'B = 2/C']
eqn = 'A = (B - 1/C)/(B - 1)**2'
assert _solve_zeros(eqn, var) == ['C = 0', 'B = 1']
eqn = 'A = B + 1'
assert _solve_zeros(eqn, var) == []

eqn = 'A**2 + B*(2 - C) < C*A'
var = list('ABC')
res = simplify(eqn, variables=var, target=list('CAB'), all=True)
#print('\n#####\n'.join(res))