Changeset 832
- Timestamp:
- 09/30/15 23:53:28 (8 months ago)
- Location:
- mystic/mystic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/mystic/_symbolic.py
r831 r832 391 391 392 392 if not permute: 393 return None if not solns[:1] else solns[0] 393 sol = None if not solns[:1] else solns[0] 394 return '' if sol and not sol.strip() else sol 394 395 return tuple(solns) 395 396 … … 641 642 soln = _solve_single(constraints, variables=variables, \ 642 643 target=target, **kwds) 644 # for corner case where has something like: '0*xN' 645 if not soln or not soln.strip(): 646 if target in [None, False]: target = [] 647 elif isinstance(target, str): target = target.split(',') 648 else: target = list(target) 649 soln = _solve_single(constraints, variables=variables, \ 650 target=target[1:], **kwds) 643 651 else: 644 652 soln = _solve_linear(constraints, variables=variables, \ -
mystic/mystic/symbolic.py
r831 r832 176 176 res = solve(eqn.replace(cmp,'='), target=target, **kwds) 177 177 _eqn = res.replace('=',cmp) 178 if verbose: print _eqn178 if verbose: print 'in: %s\nout: %s' % (eqn, _eqn) 179 179 if not cmp.count('<')+cmp.count('>'): 180 180 return _eqn … … 182 182 locals = kwds['locals'] if 'locals' in kwds else None 183 183 if locals is None: locals = {} 184 locals.update(dict((var,rand()) for var in get_variables(res, vars))) 184 locals.update(dict((var,rand()) for var in get_variables(eqn, vars))) 185 if verbose: print locals 185 186 locals_ = _locals.copy() 186 187 locals_.update(locals) #XXX: allow this?
Note: See TracChangeset
for help on using the changeset viewer.