mirror of
https://github.com/Z3Prover/z3
synced 2025-04-30 04:15:51 +00:00
Merge branch 'unstable' of https://github.com/Z3Prover/z3 into contrib
Conflicts: README src/api/ml/build-lib.sh src/api/ml/z3.ml src/api/ml/z3.mli src/api/ml/z3_stubs.c
This commit is contained in:
commit
1d49f61b9a
395 changed files with 46184 additions and 69505 deletions
|
@ -46,6 +46,15 @@ class ComplexExpr:
|
|||
other = _to_complex(other)
|
||||
return ComplexExpr(other.r*self.r - other.i*self.i, other.i*self.r + other.r*self.i)
|
||||
|
||||
def __pow__(self, k):
|
||||
if k == 0:
|
||||
return ComplexExpr(1, 0)
|
||||
if k == 1:
|
||||
return self
|
||||
if k < 0:
|
||||
return (self ** (-k)).inv()
|
||||
return reduce(lambda x, y: x * y, [self for _ in xrange(k)], ComplexExpr(1, 0))
|
||||
|
||||
def inv(self):
|
||||
den = self.r*self.r + self.i*self.i
|
||||
return ComplexExpr(self.r/den, -self.i/den)
|
||||
|
@ -65,9 +74,6 @@ class ComplexExpr:
|
|||
def __neq__(self, other):
|
||||
return Not(self.__eq__(other))
|
||||
|
||||
def __pow__(self, k):
|
||||
|
||||
|
||||
def simplify(self):
|
||||
return ComplexExpr(simplify(self.r), simplify(self.i))
|
||||
|
||||
|
@ -107,4 +113,5 @@ print(s.model())
|
|||
s.add(x.i != 1)
|
||||
print(s.check())
|
||||
# print(s.model())
|
||||
print (3 + I)^2/(5 - I)
|
||||
print ((3 + I) ** 2)/(5 - I)
|
||||
print ((3 + I) ** -3)/(5 - I)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue