Skip to content

Commit

Permalink
Added unary plus test for Jet
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsanders committed Aug 19, 2015
1 parent 5b0ba60 commit 293a372
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/root_finding_tests/auto_diff_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@ Jet = ValidatedNumerics.Jet

facts("Jet tests") do
a = Jet(1, 1)

@fact zero(a) == Jet(0, 0) --> true
@fact one(a) == Jet(1, 0) --> true
@fact -a == Jet(-1, -1) --> true
@fact +a == 2a - a --> true

end

facts("AutoDiff tests") do
facts("AutoDiff tests") do

@fact D(x -> x^2, 3) == 6 --> true
@fact D(x -> (x+1)/(x-2), 1) == -3.0 --> true

f(x) = sin(2x) - x

for a in (-3, 3, 7, 11)
@fact D(f, a) == 2*cos(2a) - 1 --> true
@fact D(tan, a) == 1. / (cos(a)^2) --> true

if a > 0.
@fact D(log, a) == 1. / a --> true
@fact D(x -> x^(1//2), a) == 0.5*a^(-0.5) --> true
Expand All @@ -38,8 +39,8 @@ facts("AutoDiff tests") do
@fact D(acos, a) == -1. / sqrt(1 - a^2) --> true
@fact D(atan, a) == 1. / (1 + a^2) --> true
end



end

Expand Down

0 comments on commit 293a372

Please sign in to comment.