I'm trying to solve a system of 2 equations. They are the result of substituting initial conditions into the solution returned from dsolve are of the form f(0)=expr, where f is a Function, and 0 is zero.
What is interesting is that it fails the first time, but succeeds when I call it a second time and then succeeds every time after. I haven't verified the that the solution is accurate.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in getit(self)
216 try:
--> 217 return self._assumptions[fact]
218 except KeyError:
KeyError: 'zero'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in getit(self)
216 try:
--> 217 return self._assumptions[fact]
218 except KeyError:
KeyError: 'zero'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in getit(self)
216 try:
--> 217 return self._assumptions[fact]
218 except KeyError:
KeyError: 'real'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-30-b2993472ce67> in <module>()
----> 1 initConds=solve([InitCond1,InitCond2],(C1,C2))
2 initConds
//anaconda/lib/python3.4/site-packages/sympy/solvers/solvers.py in solve(f, *symbols, **flags)
909 solution = _solve(f[0], *symbols, **flags)
910 else:
--> 911 solution = _solve_system(f, symbols, **flags)
912
913 #
//anaconda/lib/python3.4/site-packages/sympy/solvers/solvers.py in _solve_system(exprs, symbols, **flags)
1446 i, d = _invert(g, *symbols)
1447 g = d - i
-> 1448 g = g.as_numer_denom()[0]
1449 if manual:
1450 failed.append(g)
//anaconda/lib/python3.4/site-packages/sympy/core/add.py in as_numer_denom(self)
433 denoms, numers = [list(i) for i in zip(*iter(nd.items()))]
434 n, d = self.func(*[Mul(*(denoms[:i] + [numers[i]] + denoms[i + 1:]))
--> 435 for i in range(len(numers))]), Mul(*denoms)
436
437 return _keep_coeff(ncon, n), _keep_coeff(dcon, d)
//anaconda/lib/python3.4/site-packages/sympy/core/add.py in <listcomp>(.0)
433 denoms, numers = [list(i) for i in zip(*iter(nd.items()))]
434 n, d = self.func(*[Mul(*(denoms[:i] + [numers[i]] + denoms[i + 1:]))
--> 435 for i in range(len(numers))]), Mul(*denoms)
436
437 return _keep_coeff(ncon, n), _keep_coeff(dcon, d)
//anaconda/lib/python3.4/site-packages/sympy/core/operations.py in __new__(cls, *args, **options)
39 return args[0]
40
---> 41 c_part, nc_part, order_symbols = cls.flatten(args)
42 is_commutative = not nc_part
43 obj = cls._from_args(c_part + nc_part, is_commutative)
//anaconda/lib/python3.4/site-packages/sympy/core/mul.py in flatten(cls, seq)
181 a, b = b, a
182 assert not a is S.One
--> 183 if not a.is_zero and a.is_Rational:
184 r, b = b.as_coeff_Mul()
185 if b.is_Add:
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in getit(self)
219 if self._assumptions is self.default_assumptions:
220 self._assumptions = self.default_assumptions.copy()
--> 221 return _ask(fact, self)
222
223 getit.func_name = as_property(fact)
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in _ask(fact, obj)
262 pass
263 else:
--> 264 a = evaluate(obj)
265 if a is not None:
266 assumptions.deduce_all_facts(((fact, a),))
//anaconda/lib/python3.4/site-packages/sympy/core/mul.py in _eval_is_zero(self)
989 zero = infinite = False
990 for a in self.args:
--> 991 z = a.is_zero
992 if z:
993 if infinite:
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in getit(self)
219 if self._assumptions is self.default_assumptions:
220 self._assumptions = self.default_assumptions.copy()
--> 221 return _ask(fact, self)
222
223 getit.func_name = as_property(fact)
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in _ask(fact, obj)
274 continue
275 if pk in handler_map:
--> 276 _ask(pk, obj)
277
278 # we might have found the value of fact
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in _ask(fact, obj)
262 pass
263 else:
--> 264 a = evaluate(obj)
265 if a is not None:
266 assumptions.deduce_all_facts(((fact, a),))
//anaconda/lib/python3.4/site-packages/sympy/core/expr.py in _eval_is_positive(self)
662 def _eval_is_positive(self):
663 if self.is_number:
--> 664 if self.is_real is False:
665 return False
666 try:
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in getit(self)
219 if self._assumptions is self.default_assumptions:
220 self._assumptions = self.default_assumptions.copy()
--> 221 return _ask(fact, self)
222
223 getit.func_name = as_property(fact)
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in _ask(fact, obj)
274 continue
275 if pk in handler_map:
--> 276 _ask(pk, obj)
277
278 # we might have found the value of fact
//anaconda/lib/python3.4/site-packages/sympy/core/assumptions.py in _ask(fact, obj)
262 pass
263 else:
--> 264 a = evaluate(obj)
265 if a is not None:
266 assumptions.deduce_all_facts(((fact, a),))
//anaconda/lib/python3.4/site-packages/sympy/core/expr.py in _eval_is_negative(self)
692 try:
693 # check to see that we can get a value
--> 694 n2 = self._eval_evalf(2)
695 if n2 is None:
696 raise AttributeError
//anaconda/lib/python3.4/site-packages/sympy/core/function.py in _eval_evalf(self, prec)
484
485 with mpmath.workprec(prec):
--> 486 v = func(*args)
487
488 return Expr._from_mpmath(v, prec)
TypeError: 'mpc' object is not callable