Skip to content

Commit

Permalink
add pi for irrational tests
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Mar 11, 2020
1 parent a67c657 commit 685a0fe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/finite_difference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@test norm(Calculus.finite_difference(x -> sin(x), 1.0, :forward) - cos(1.0)) < 10e-4
@test norm(Calculus.finite_difference(x -> sin(x), 1.0, :central) - cos(1.0)) < 10e-4
@test norm(Calculus.finite_difference(x -> sin(x), 1.0) - cos(1.0)) < 10e-4
@test norm(Calculus.finite_difference(x -> sin(x), pi) + 1) < 10e-4

@test norm(Calculus.finite_difference(x -> exp(-x), 1.0, :forward) - (-exp(-1.0))) < 10e-4
@test norm(Calculus.finite_difference(x -> exp(-x), 1.0, :central) - (-exp(-1.0))) < 10e-4
Expand All @@ -21,6 +22,7 @@
@test norm(Calculus.finite_difference(x -> x[1]^2, [1.0], :forward) - [2.0]) < 10e-4
@test norm(Calculus.finite_difference(x -> x[1]^2, [1.0], :central) - [2.0]) < 10e-4
@test norm(Calculus.finite_difference(x -> x[1]^2, [1.0]) - [2.0]) < 10e-4
@test norm(Calculus.finite_difference(x -> x[1]^2, [float(pi)]) - [2*pi])) < 10e-4

@test norm(Calculus.finite_difference(x -> sin(x[1]), [1.0], :forward) - [cos(1.0)]) < 10e-4
@test norm(Calculus.finite_difference(x -> sin(x[1]), [1.0], :central) - [cos(1.0)]) < 10e-4
Expand Down

0 comments on commit 685a0fe

Please sign in to comment.