Skip to content

Commit f895ddd

Browse files
committed
2 parents 8a9fc2c + 4548c22 commit f895ddd

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

REQUIRE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
julia 0.3
2-
Compat
1+
julia 0.3.7
2+
Compat 0.4.0

src/Calculus.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ module Calculus
1414
jacobian,
1515
second_derivative
1616

17+
import Base: gradient
18+
1719
# TODO: Debate type system more carefully
1820
# abstract BundledFunction
1921
# abstract ScalarFunction

src/differentiate.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ symbolic_derivative_1arg_list = [
161161
( :asech, :( -1 / x / sqrt(1 - x^2) ))
162162
( :acsch, :( -1 / abs(x) / sqrt(1 + x^2) ))
163163
( :acoth, :( 1 / (1 - x^2) ))
164-
( :erf, :( 2 * exp(-square(x)) / sqrt(pi) ))
165-
( :erfc, :( -2 * exp(-square(x)) / sqrt(pi) ))
166-
( :erfi, :( 2 * exp(square(x)) / sqrt(pi) ))
164+
( :erf, :( 2 * exp(-x*x) / sqrt(pi) ))
165+
( :erfc, :( -2 * exp(-x*x) / sqrt(pi) ))
166+
( :erfi, :( 2 * exp(x*x) / sqrt(pi) ))
167167
( :gamma, :( digamma(x) * gamma(x) ))
168168
( :lgamma, :( digamma(x) ))
169169
( :digamma, :( trigamma(x) ))
@@ -196,7 +196,7 @@ export symbolic_derivatives_1arg
196196

197197
# deprecated: for backward compatibility with packages that used
198198
# this unexported interface.
199-
derivative_rules = Array((Symbol,Expr),0)
199+
derivative_rules = Array(@Compat.compat(Tuple{Symbol,Expr}),0)
200200
for (s,ex) in symbolic_derivative_1arg_list
201201
push!(derivative_rules, (s, :(xp*$ex)))
202202
end

src/symbolic.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function simplify(::SymbolParameter{:+}, args)
140140
return args[1]
141141
else
142142
(sum, sym_args) = sum_numeric_args(args)
143-
args = sum==0 ? sym_args : [sum, sym_args]
143+
args = sum==0 ? sym_args : [sum; sym_args]
144144
return Expr(:call, :+, args...)
145145
end
146146
end
@@ -182,7 +182,7 @@ function simplify(::SymbolParameter{:*}, args)
182182
return Expr(:call, :-, args[2])
183183
else
184184
(prod, sym_args) = mul_numeric_args(args)
185-
args = prod==1 ? sym_args : [prod, sym_args]
185+
args = prod==1 ? sym_args : [prod; sym_args]
186186
return Expr(:call, :*, args...)
187187
end
188188
end

test/symbolic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@ end
9696
# Tests with ifelse
9797
#
9898
@test isequal(differentiate(:(ifelse(x < 1, exp(x^2), 1/x)), :x), :(ifelse(x < 1,2x * exp(x^2), -1/x^2)))
99-
@test isequal(differentiate(:(ifelse(x <= 0, 0, ifelse(x > 1, 1, x))), : x),
99+
@test isequal(differentiate(:(ifelse(x <= 0, 0, ifelse(x > 1, 1, x))), :x),
100100
:(ifelse(x <= 0, 0, ifelse(x > 1, 0, 1))))

0 commit comments

Comments
 (0)