Skip to content

Commit

Permalink
Fix compat issue
Browse files Browse the repository at this point in the history
Signed-off-by: ErikQQY <2283984853@qq.com>
  • Loading branch information
ErikQQY committed Mar 23, 2024
1 parent fa5bcc2 commit dabcdd6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
ForwardDiff = "0.10.36"
InvertedIndices = "1.3"
QuadGK = "2.9"
SpecialFunctions = "2.3"
Expand Down
18 changes: 9 additions & 9 deletions test/Derivative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ half_derivative_of_x_square_minus_1_at_1 = 5/(3*sqrt(π))
half_derivative_of_exp_at_1 =*erf(1)+1/sqrt(π)

@testset "Test Caputo Direct Fractional Derivative" begin
@test isapprox(fracdiff(x->x, 0.5, 0, 1, 1e-8, CaputoDirect())[1], 2/sqrt(pi); atol = 1e-5)
@test isapprox(fracdiff(x->x^5, 0.5, 0, 3.2, 1e-8, CaputoDirect())[1], 4.300306216488329e2; atol = 1e-5)
@test isapprox(fracdiff(x->x^5, 0.25, 0, 3.2, 1e-8, CaputoDirect())[1], 382.1228113951680; atol = 1e-5)
@test isapprox(fracdiff(x->(x-3)^3+(x+2)^2+5, 0.5, 0, 0.83, 1e-8, CaputoDirect())[1], 23.899930581118699; atol = 1e-5)
@test isapprox(fracdiff(x->(x-3)^3+(x+2)^2+5, 0.25, 0, 0.83, 1e-8, CaputoDirect())[1], 22.96354626572943; atol = 1e-5)
@test isapprox(fracdiff(x->cos(x), 0.5, 0, 0.34, 1e-8, CaputoDirect())[1], -0.147174774607683; atol = 1e-5)
@test isapprox(fracdiff(x->cos(x), 0.25, 0, 0.34, 1e-8, CaputoDirect())[1], -0.093074344902431; atol = 1e-5)
@test isapprox(fracdiff(x->exp(-x^2), 0.5, 0, 2.3, 1e-8, CaputoDirect())[1], -0.505891017154289; atol = 1e-5)
@test isapprox(fracdiff(x->exp(-x^2), 0.25, 0, 2.3, 1e-8, CaputoDirect())[1], -0.762927553656252; atol = 1e-5)
@test isapprox(fracdiff(x->x, 0.5, 0, 1, 1e-4, CaputoDirect())[1], 2/sqrt(pi); atol = 1e-5)
@test isapprox(fracdiff(x->x^5, 0.5, 0, 3.2, 1e-4, CaputoDirect())[1], 4.300306216488329e2; atol = 1e-5)
@test isapprox(fracdiff(x->x^5, 0.25, 0, 3.2, 1e-4, CaputoDirect())[1], 382.1228113951680; atol = 1e-5)
@test isapprox(fracdiff(x->(x-3)^3+(x+2)^2+5, 0.5, 0, 0.83, 1e-4, CaputoDirect())[1], 23.899930581118699; atol = 1e-5)
@test isapprox(fracdiff(x->(x-3)^3+(x+2)^2+5, 0.25, 0, 0.83, 1e-4, CaputoDirect())[1], 22.96354626572943; atol = 1e-5)
@test isapprox(fracdiff(x->cos(x), 0.5, 0, 0.34, 1e-4, CaputoDirect())[1], -0.147174774607683; atol = 1e-5)
@test isapprox(fracdiff(x->cos(x), 0.25, 0, 0.34, 1e-4, CaputoDirect())[1], -0.093074344902431; atol = 1e-5)
@test isapprox(fracdiff(x->exp(-x^2), 0.5, 0, 2.3, 1e-4, CaputoDirect())[1], -0.505891017154289; atol = 1e-5)
@test isapprox(fracdiff(x->exp(-x^2), 0.25, 0, 2.3, 1e-4, CaputoDirect())[1], -0.762927553656252; atol = 1e-5)

@test isapprox(fracdiff(x->x, 0.5, 0, [1, 2, 3], 0.0001, CaputoDirect()), [2/sqrt(pi), 1.5957691216057408, 1.9544100476116828]; atol=1e-3)
end
Expand Down
12 changes: 6 additions & 6 deletions test/Integral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ using FractionalCalculus
using Test

@testset "Test Direct Fractional Integral" begin
@test isapprox(fracint(x->x^4, 0.5, 0, 1.23, 1e-8, RLDirect())[1], 1.163931646862977; atol = 0.00001)
@test isapprox(fracint(x->x^4, 0.25, 0, 1.23, 1e-8, RLDirect())[1], 1.64294134724409; atol = 0.00001)
@test isapprox(fracint(x->x^4, 0.15, 0, 1.23, 1e-8, RLDirect())[1], 1.878978485456182; atol = 0.00001)
@test isapprox(fracint(x->sin(x), 0.5, 0, 0.97, 1e-8, RLDirect())[1], 0.6442601778843754; atol = 0.00001)
@test isapprox(fracint(x->sin(x), 0.25, 0, 0.97, 1e-8, RLDirect())[1], 0.7448298999485293; atol = 0.00001)
@test isapprox(fracint(x->sin(x), 0.15, 0, 0.97, 1e-8, RLDirect())[1], 0.7802555196986999; atol = 0.00001)
@test isapprox(fracint(x->x^4, 0.5, 0, 1.23, 1e-4, RLDirect())[1], 1.163931646862977; atol = 0.00001)
@test isapprox(fracint(x->x^4, 0.25, 0, 1.23, 1e-4, RLDirect())[1], 1.64294134724409; atol = 0.00001)
@test isapprox(fracint(x->x^4, 0.15, 0, 1.23, 1e-4, RLDirect())[1], 1.878978485456182; atol = 0.00001)
@test isapprox(fracint(x->sin(x), 0.5, 0, 0.97, 1e-4, RLDirect())[1], 0.6442601778843754; atol = 0.00001)
@test isapprox(fracint(x->sin(x), 0.25, 0, 0.97, 1e-4, RLDirect())[1], 0.7448298999485293; atol = 0.00001)
@test isapprox(fracint(x->sin(x), 0.15, 0, 0.97, 1e-4, RLDirect())[1], 0.7802555196986999; atol = 0.00001)
end

@testset "Test Piecewise Fractional Integral" begin
Expand Down

2 comments on commit dabcdd6

@ErikQQY
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/103468

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" dabcdd632f5f5a41cb9f747c14530d561ce5d232
git push origin v0.3.0

Please sign in to comment.