Skip to content

Even more math tests, and a missing besselhx export #12169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ export
airyprime,
airyx,
besselh,
besselhx,
besseli,
besselix,
besselj,
Expand Down
2 changes: 1 addition & 1 deletion base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export sin, cos, tan, sinh, cosh, tanh, asin, acos, atan,
besselj0, besselj1, besselj, besseljx,
bessely0, bessely1, bessely, besselyx,
hankelh1, hankelh2, hankelh1x, hankelh2x,
besseli, besselix, besselk, besselkx, besselh,
besseli, besselix, besselk, besselkx, besselh, besselhx,
beta, lbeta, eta, zeta, polygamma, invdigamma, digamma, trigamma,
erfinv, erfcinv, @evalpoly

Expand Down
4 changes: 2 additions & 2 deletions test/linalg/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ let n=10
@test_approx_eq a * Hermitian(asym) a * asym
@test_approx_eq Hermitian(asym) * Hermitian(asym) asym*asym
@test_throws DimensionMismatch Hermitian(asym) * ones(eltya,n+1)
Base.LinAlg.A_mul_B!(C,a,asym)
Base.LinAlg.A_mul_B!(C,a,Hermitian(asym))
@test_approx_eq C a*asym
end
if eltya <: Real && eltya != Int
@test_approx_eq Symmetric(asym) * Symmetric(asym) asym*asym
@test_approx_eq Symmetric(asym) * a asym * a
@test_approx_eq a * Symmetric(asym) a * asym
@test_throws DimensionMismatch Symmetric(asym) * ones(eltya,n+1)
Base.LinAlg.A_mul_B!(C,a,asym)
Base.LinAlg.A_mul_B!(C,a,Symmetric(asym))
@test_approx_eq C a*asym
end

Expand Down
3 changes: 3 additions & 0 deletions test/linalg2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ end
@test UniformScaling(α)./α == UniformScaling(1.0)
@test α + UniformScaling(1.0) == UniformScaling(1.0) + α
@test α - UniformScaling(1.0) == -(UniformScaling(1.0) - α)
@test copy(UniformScaling(one(Float64))) == UniformScaling(one(Float64))
@test sprint(show,UniformScaling(one(Float32))) == "Base.LinAlg.UniformScaling{Float32}\n1.0*I"

λ = complex(randn(),randn())
J = UniformScaling(λ)
@test ndims(J) == 2
Expand Down
24 changes: 17 additions & 7 deletions test/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ end
@test erfcinv(one(Int)) == erfcinv(1.0)

# airy
@test_approx_eq airy(1.8) 0.0470362168668458052247
@test_approx_eq airy(1.8) airyai(1.8)
@test_approx_eq airyprime(1.8) -0.0685247801186109345638
@test_approx_eq airyaiprime(1.8) airyprime(1.8)
Expand All @@ -140,12 +139,16 @@ end
@test_throws Base.Math.AmosException airybi(200)
@test_throws ArgumentError airy(5,one(Complex128))
z = 1.8 + 1.0im
@test_approx_eq airyx(z) airyx(0,z)
@test_approx_eq airyx(0, z) airy(0, z) * exp(2/3 * z * sqrt(z))
@test_approx_eq airyx(1, z) airy(1, z) * exp(2/3 * z * sqrt(z))
@test_approx_eq airyx(2, z) airy(2, z) * exp(-abs(real(2/3 * z * sqrt(z))))
@test_approx_eq airyx(3, z) airy(3, z) * exp(-abs(real(2/3 * z * sqrt(z))))
@test_throws ArgumentError airyx(5,z)
for elty in [Complex64,Complex128]
@test_approx_eq airy(convert(elty,1.8)) 0.0470362168668458052247
z = convert(elty,z)
@test_approx_eq airyx(z) airyx(0,z)
@test_approx_eq airyx(0, z) airy(0, z) * exp(2/3 * z * sqrt(z))
@test_approx_eq airyx(1, z) airy(1, z) * exp(2/3 * z * sqrt(z))
@test_approx_eq airyx(2, z) airy(2, z) * exp(-abs(real(2/3 * z * sqrt(z))))
@test_approx_eq airyx(3, z) airy(3, z) * exp(-abs(real(2/3 * z * sqrt(z))))
@test_throws ArgumentError airyx(5,z)
end

# bessely0, bessely1, besselj0, besselj1
@test_approx_eq besselj0(Float32(2.0)) besselj0(Float64(2.0))
Expand Down Expand Up @@ -206,6 +209,7 @@ j43 = besselj(4,3.)
@test_approx_eq besselj(0.1, complex(-0.4)) 0.820421842809028916 + 0.266571215948350899im
@test_approx_eq besselj(3.2, 1.3+0.6im) 0.01135309305831220201 + 0.03927719044393515275im
@test_approx_eq besselj(1, 3im) 3.953370217402609396im
@test_approx_eq besselj(1.0,3im) besselj(1,3im)
@test_throws Base.Math.AmosException besselj(20,1000im)

# besselk
Expand Down Expand Up @@ -234,6 +238,12 @@ y33 = bessely(3,3.)
@test_throws DomainError bessely(0.4,Float32(-1.0))
@test_throws DomainError bessely(1,Float32(-1.0))

#besselhx
for elty in [Complex64,Complex128]
z = convert(elty, 1.0 + 1.9im)
@test_approx_eq besselhx(1.0, 1, z) convert(elty,-0.5949634147786144 - 0.18451272807835967im)
end

# issue #6653
for f in (besselj,bessely,besseli,besselk,hankelh1,hankelh2)
@test_approx_eq f(0,1) f(0,Complex128(1))
Expand Down