@@ -8,7 +8,7 @@ A helper function for computing the derivative of an expression with respect to
88"""
99function derivative (O, v; simplify = true )
1010 if O isa AbstractArray
11- Num[expand_derivatives (Differential (v)(value (o)), simplify) for o in O]
11+ Num[Num ( expand_derivatives (Differential (v)(value (o)), simplify) ) for o in O]
1212 else
1313 Num (expand_derivatives (Differential (v)(value (O)), simplify))
1414 end
@@ -23,7 +23,7 @@ A helper function for computing the gradient of an expression with respect to
2323an array of variable expressions.
2424"""
2525function gradient (O, vars:: AbstractVector ; simplify = true )
26- Num[expand_derivatives (Differential (v)(value (O)),simplify) for v in vars]
26+ Num[Num ( expand_derivatives (Differential (v)(value (O)),simplify) ) for v in vars]
2727end
2828
2929"""
@@ -35,7 +35,7 @@ A helper function for computing the Jacobian of an array of expressions with res
3535an array of variable expressions.
3636"""
3737function jacobian (ops:: AbstractVector , vars:: AbstractVector ; simplify = true )
38- Num[expand_derivatives (Differential (value (v))(value (O)),simplify) for O in ops, v in vars]
38+ Num[Num ( expand_derivatives (Differential (value (v))(value (O)),simplify) ) for O in ops, v in vars]
3939end
4040
4141"""
@@ -57,7 +57,7 @@ function sparsejacobian(ops::AbstractVector, vars::AbstractVector; simplify = tr
5757 exprs = Num[]
5858
5959 for (i,j) in zip (I, J)
60- push! (exprs, expand_derivatives (Differential (vars[j])(ops[i]), simplify))
60+ push! (exprs, Num ( expand_derivatives (Differential (vars[j])(ops[i]), simplify) ))
6161 end
6262 sparse (I,J, exprs, length (ops), length (vars))
6363end
0 commit comments