Skip to content

Commit 000c2da

Browse files
committed
don't add zeros in expand_derivatives
1 parent d737990 commit 000c2da

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/differentials.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function expand_derivatives(O::Operation,simplify=true)
4949
isa(o.op, Variable) && return O
5050

5151
l = length(o.args)
52-
exprs = []
52+
exprs = Expression[]
5353
c = 0
5454

5555
for i in 1:l
@@ -62,7 +62,10 @@ function expand_derivatives(O::Operation,simplify=true)
6262
else
6363
derivative(o, i) * t2
6464
end
65-
if x isa Expression
65+
66+
if _iszero(x)
67+
continue
68+
elseif x isa Expression
6669
push!(exprs, x)
6770
else
6871
c += x

0 commit comments

Comments
 (0)