Skip to content
Permalink
Browse files

partial derivative bugfix

  • Loading branch information
rileyjmurray committed Nov 12, 2019
1 parent 34b6d25 commit 61205194a6127bf10cc751efa5dfdf8f180967e6
Showing with 5 additions and 3 deletions.
  1. +2 −0 CHANGELOG.md
  2. +1 −1 sageopt/symbolic/polynomials.py
  3. +2 −2 sageopt/symbolic/signomials.py
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# [0.4.2] - unreleased
## Added
- A ``metadata`` field to Signomial and Polynomial objects.
## Changed
- ``Signomial.partial`` and ``Polynomial.partial`` to correctly work with nonconstant coefficients.


# [0.4.1] - 2019-10-13
@@ -355,7 +355,7 @@ def partial(self, i):
vec = self.alpha[j, :].copy()
c = self.c[j] * vec[i]
vec[i] -= 1
d[tuple(vec.tolist())] = c
d[tuple(vec.tolist())] += c
d[self.n * (0,)] += 0
p = Polynomial(d)
return p
@@ -417,9 +417,9 @@ def partial(self, i):
d = defaultdict(int)
for j in range(self.m):
c = self.c[j] * self.alpha[j, i]
if c != 0:
if (not isinstance(c, __NUMERIC_TYPES__)) or c != 0:
vec = self.alpha[j, :].copy()
d[tuple(vec.tolist())] = c
d[tuple(vec.tolist())] += c
d[self.n * (0,)] += 0
p = Signomial(d)
return p

0 comments on commit 6120519

Please sign in to comment.
You can’t perform that action at this time.