Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SciFracX/FractionalCalculus.jl
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.4
Choose a base ref
...
head repository: SciFracX/FractionalCalculus.jl
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 2,105 additions and 508 deletions.
  1. +55 −0 .github/workflows/Benchmark.yml
  2. +2 −2 .github/workflows/CI.yml
  3. +3 −1 .gitignore
  4. +14 −6 Project.toml
  5. +72 −62 README.md
  6. +9 −0 bench/.JuliaFormatter.toml
  7. +4 −0 bench/Project.toml
  8. +6 −0 bench/README.md
  9. +9 −0 bench/derivative.jl
  10. +19 −0 bench/runbenchmarks.jl
  11. +5 −2 docs/make.jl
  12. +50 −12 docs/src/Derivative/derivative.md
  13. +44 −18 docs/src/Derivative/derivativeapi.md
  14. +2 −2 docs/src/Derivative/short_memory_effect.md
  15. +23 −0 docs/src/Derivative/symderivative.md
  16. +16 −7 docs/src/Example/derivative.md
  17. +3 −3 docs/src/Integral/integral.md
  18. +21 −10 docs/src/Integral/integralapi.md
  19. +10 −0 docs/src/Integral/symintegral.md
  20. BIN docs/src/assets/HadamardIntegral.png
  21. BIN docs/src/assets/different_order_cos_derivative.png
  22. +2 −12 docs/src/index.md
  23. +1 −1 example/3dexample.jl
  24. +1 −1 example/arbitrary_order_derivative.jl
  25. +11 −0 example/derivative_of_cos.jl
  26. +2 −3 example/derivative_of_sin.jl
  27. +1 −1 example/derivative_of_x.jl
  28. +1 −1 example/integer_high_order_deriavtive.jl
  29. +1 −1 example/integer_order_derivative_example.jl
  30. +1 −1 example/integral_of_x.jl
  31. +35 −0 src/Derivative/ABC.jl
  32. +272 −87 src/Derivative/Caputo.jl
  33. +38 −0 src/Derivative/CaputoFabrizio.jl
  34. +12 −3 src/Derivative/Derivative.jl
  35. +49 −30 src/Derivative/GL.jl
  36. +33 −16 src/Derivative/Hadamard.jl
  37. +132 −48 src/Derivative/RL.jl
  38. +54 −4 src/Derivative/Riesz.jl
  39. +132 −0 src/Derivative/SymbolicDiff.jl
  40. +397 −0 src/Derivative/mlfun.jl
  41. +32 −11 src/FractionalCalculus.jl
  42. +183 −0 src/Integral/Hadamard.jl
  43. +5 −2 src/Integral/Integral.jl
  44. +61 −94 src/Integral/RL.jl
  45. +114 −0 src/Integral/SymbolicInt.jl
  46. +61 −43 test/Derivative.jl
  47. +52 −23 test/Integral.jl
  48. +3 −1 test/Project.toml
  49. +26 −0 test/SymbolicDiffTests.jl
  50. +22 −0 test/SymbolicIntTests.jl
  51. +4 −0 test/runtests.jl
55 changes: 55 additions & 0 deletions .github/workflows/Benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Benchmarks
on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1'
arch: x64
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Run benchmark
run: |
cd bench
julia --project --color=yes -e '
using Pkg;
Pkg.develop(PackageSpec(path=joinpath(pwd(), "..")));
Pkg.instantiate();
include("runbenchmarks.jl")'
- name: Parse & Upload Benchmark Results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Benchmark Results
tool: 'julia'
output-file-path: bench/benchmark_results.json
summary-always: true
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-always: true
alert-threshold: "200%"
fail-on-alert: true
benchmark-data-dir-path: benchmarks
auto-push: ${{ github.event_name != 'pull_request' }}
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- 'nightly'
- '1'
- '~1.10.0-0'
os:
- ubuntu-latest
- macOS-latest
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -24,4 +24,6 @@ docs/site/
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml
Manifest.toml

bench/benchmark_results.json
20 changes: 14 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -2,21 +2,29 @@ name = "FractionalCalculus"
uuid = "638fb199-4bb2-4014-80c8-6dc0d90f156b"
license = "MIT"
authors = ["Qingyu Qu <erikqqy123@gmail.com>"]
version = "0.2.4"
version = "0.3.0"

[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
InvertedIndices = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
SpecialMatrices = "928aab9d-ef52-54ac-8ca1-acd7ca42c160"
SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
InvertedIndices = "1.1"
QuadGK = "2.4.2"
SpecialFunctions = "1.6.2, 2"
SpecialMatrices = "2.0.0"
julia = "1.0"
ForwardDiff = "0.10.36"
InvertedIndices = "1.3"
QuadGK = "2.9"
SpecialFunctions = "2.3"
SpecialMatrices = "3"
SymbolicUtils = "1.5"
Symbolics = "5.13"
UnPack = "1.0.2"
julia = "1.9"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
134 changes: 72 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# FractionalCalculus.jl

<p align="center">
<img width="250px" src="https://raw.githubusercontent.com/SciFracX/FractionalCalculus.jl/master/docs/src/assets/logo.svg"/>
</p>


<p align="center">
<a href="https://github.com/SciFracX/FractionalCalculus.jl/actions?query=workflow%3ACI">
<img alt="building" src="https://github.com/SciFracX/FractionalCalculus.jl/workflows/CI/badge.svg">
</a>
@@ -21,9 +15,6 @@
<a href="https://zenodo.org/badge/latestdoi/420992306">
<img src="https://zenodo.org/badge/420992306.svg" alt="DOI">
</a>
</p>

<p align="center">
<a href="https://github.com/SciFracX/FractionalCalculus.jl/issues">
<img alt="GitHub issues" src="https://img.shields.io/github/issues/SciFracX/FractionalCalculus.jl?style=flat-square">
</a>
@@ -33,43 +24,36 @@
<a href="https://github.com/SciFracX/FractionalCalculus.jl/network">
<img alt="GitHub forks" src="https://img.shields.io/github/forks/SciFracX/FractionalCalculus.jl?style=flat-square">
</a>
</p>

FractionalCalculus.jl provides support for fractional calculus computing.

## 🎇 Installation

If you have already install Julia, you can install FractionalCalculus.jl in REPL using Julia package manager:
If you have already installed Julia, you can install FractionalCalculus.jl in REPL using Julia package manager:

```julia
pkg> add FractionalCalculus
```

Or if you want to experience the latest version of FractionalCalculus.jl:

```julia
pkg> add FractionalCalculus#master
```

## 🦸 Quick start

### Derivative

To compute the fractional derivative in a specific point, for example, compute <img src="https://latex.codecogs.com/svg.image?\inline&space;\alpha=0.2" title="\inline \alpha=0.2" /> derivative of <img src="https://latex.codecogs.com/svg.image?\inline&space;f(x)=x" title="\inline f(x)=x" /> in <img src="https://latex.codecogs.com/svg.image?\inline&space;x=1" title="\inline x=1" /> with step size <img src="https://latex.codecogs.com/svg.image?\inline&space;h=0.0001" title="\inline h=0.0001" /> using **Riemann Liouville** sense:
To compute the fractional derivative in a specific point, for example, compute $\alpha = 0.2$ derivative of $f(x) = x$ in $x = 1$ with step size $h = 0.0001$ using **Riemann Liouville** sense:

```julia
julia> fracdiff(x->x, 0.2, 1, 0.0001, RLDiff_Approx())
julia> fracdiff(x->x, 0.2, 1, 0.0001, RLDiffL1())
1.0736712740308347
```

This will return the estimated value with high precision.

### Integral

To compute the fractional integral in a specific point, for example, compute the semi integral of <img src="https://latex.codecogs.com/svg.image?\inline&space;f(x)=x" title="\inline f(x)=x" /> in <img src="https://latex.codecogs.com/svg.image?\inline&space;x=1" title="\inline x=1" /> with step size <img src="https://latex.codecogs.com/svg.image?\inline&space;h=0.0001" title="\inline h=0.0001" /> using **Riemann-Liouville** sense:
To compute the fractional integral in a specific point, for example, compute the semi integral of $f(x) = x$ in $x = 1$ with step size $h = 0.0001$ using **Riemann-Liouville** sense:

```julia
julia> fracint(x->x, 0.5, 1, 0.0001, RLInt_Approx())
julia> fracint(x->x, 0.5, 1, 0.0001, RLIntApprox())
0.7522525439593486
```

@@ -81,64 +65,81 @@ This will return the estimated value with high precision.
Current Algorithms
├── FracDiffAlg
│ ├── Caputo
| | ├── Caputo_Direct
| | ├── Caputo_Piecewise
| | ├── Caputo_Diethelm
| | └── Caputo_High_Precision
| | ├── CaputoDirect
| | ├── CaputoTrap
| | ├── CaputoDiethelm
| | ├── CaputoHighPrecision
| | ├── CaputoL1
| | ├── CaputoL2
| | └── CaputoHighOrder
| |
│ ├── Grünwald Letnikov
| | ├── GL_Direct
| | ├── GL_Multiplicative_Additive
| | ├── GL_Lagrange_Three_Point_Interp
| | └── GL_High_Precision
| | ├── GLDirect
| | ├── GLMultiplicativeAdditive
| | ├── GLLagrangeThreePointInterp
| | └── GLHighPrecision
| |
| ├── Riemann Liouville
| | ├── RLDiff_Approx
| | ├── RL_Linear_Spline_Interp
| | ├── RLDiff_Matrix
| | ├── RL_G1
| | └── RL_D
| | ├── RLDiffL1
| | ├── RLDiffL2
| | ├── RLDiffL2C
| | ├── RLLinearSplineInterp
| | ├── RLDiffMatrix
| | ├── RLG1
| | └── RLD
| |
| ├── Hadamard
| | ├── Hadamard_LRect
| | ├── Hadamard_RRect
| | └── Hadamard_Trap
| | ├── HadamardLRect
| | ├── HadamardRRect
| | └── HadamardTrap
| |
| ├── Riesz
| | ├── RieszSymmetric
| | └── RieszOrtigueira
| |
| ├── Caputo-Fabrizio
| | └── CaputoFabrizioAS
| |
| └── Riesz
| └── Riesz_Symmetric
| └── Atanagana Baleanu
| └── AtanganaSeda
|
└── FracIntAlg
└── Riemann Liouville
├── RL_Direct
├── RL_Piecewise
├── RL_LinearInterp
├── RLInt_Approx
├── RLInt_Matrix
├── RLInt_Simpson
├── RLInt_Trapezoidal
├── RLInt_Rectangular
└── RLInt_Cubic_Spline_Interp
├── Riemann Liouville
| ├── RLDirect
| ├── RLPiecewise
| ├── RLLinearInterp
| ├── RLIntApprox
| ├── RLIntMatrix
| ├── RLIntSimpson
| ├── RLIntTrapezoidal
| ├── RLIntRectangular
| └── RLIntCubicSplineInterp
|
└── Hadamard
└── HadamardMat
```

For detailed usage, please refer to [our manual](https://scifracx.org/FractionalCalculus.jl/dev/Derivative/derivativeapi/).

## 🖼️ Example

Let's see examples here:

Compute the semi-derivative of <img src="https://latex.codecogs.com/svg.image?\inline&space;f(x)=x" title="\inline f(x)=x" /> in the interval <img src="https://latex.codecogs.com/svg.image?[0,\&space;1]" title="[0,\ 1]" />:
Compute the semi-derivative of $f(x) = x$ in the interval $\left[0, 1\right]$:

![Plot](/docs/src/assets/semiderivativeplot.png)

We can see the computing retains high precision⬆️.
We can see that computing retains high precision⬆️.

Compute different order derivative of <img src="https://latex.codecogs.com/svg.image?\inline&space;f(x)=x" title="\inline f(x)=x" />:
Compute different order derivative of $f(x) = x$:

![Different Order](/docs/src/assets/different_order_x_derivative.png)

Also different order derivative of <img src="https://latex.codecogs.com/svg.image?\inline&space;f(x)=\sin(x)" title="\inline f(x)=\sin(x)" />:
Also different order derivative of $f(x) = \sin(x)$:

![Different Order of sin](/docs/src/assets/different_order_sin_derivative.png)

And also different order integral of <img src="https://latex.codecogs.com/svg.image?\inline&space;f(x)=x" title="\inline f(x)=x" />:
And also different order integral of $f(x) = x$:

![Different Order Of x](/docs/src/assets/different_order_x_integral.png)

@@ -150,6 +151,19 @@ Or arbitrary order derivative? A piece of cake!!😉
-->

## 🧙 Symbolic Fractional Differentiation and Integration

Thanks to SymbolicUtils.jl, FractionalCalculus.jl can do symbolic fractional differentiation and integration now!!

```julia
julia> using FractionalCalculus, SymbolicUtils
julia> @syms x
julia> semidiff(log(x))
log(4x) / sqrt(πx)
julia> semiint(x^4)
0.45851597901024005(x^4.5)
```

## 📢 Status

Right now, FractionalCalculus.jl has only supports for little algorithms:
@@ -161,22 +175,18 @@ Fractional Derivative:
- [x] Riemann-Liouville fractional derivative
- [x] Riesz fractional derivative
- [x] Hadamard fractional derivative
- [ ] Caputo-Fabrizio fractional derivative
- [ ] Atangana-Baleanu fractional derivative
- [x] Caputo-Fabrizio fractional derivative
- [x] Atangana-Baleanu fractional derivative
- [ ] Marchaud fractional derivative
- [ ] Weyl fractional derivative
- [ ] Weyl fractional derivative
- [ ] ......

Fractional Integral:
- [x] Riemann-Liouville fractional integral
- [ ] Hadamard fractional integral
- [x] Hadamard fractional integral
- [ ] Atangana-Baleanu fractional integral
- [ ] ......

## 🧙 About Symbolic differentiation and integration

I am trying to find a way to support symbolic differentiation and integration features🤔.

## 📚 Reference

FractionalCalculus.jl is built upon the hard work of many scientific researchers, I sincerely appreciate what they have done to help the development of science and technology.
9 changes: 9 additions & 0 deletions bench/.JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
style = "sciml"
whitespace_in_kwargs = false
always_use_return = true
margin = 92
indent = 4
format_docstrings = true
separate_kwargs_with_semicolon = true
always_for_in = true
annotate_untyped_fields_with_any = false
4 changes: 4 additions & 0 deletions bench/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
FractionalCalculus = "638fb199-4bb2-4014-80c8-6dc0d90f156b"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
6 changes: 6 additions & 0 deletions bench/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# FractionalCalculus.jl Continuous Benchmarking

Currently, we use the BenchmarkTools.jl package to benchmark the performance of FractionalCalculus.jl over time.

This is built using https://github.com/benchmark-action/github-action-benchmark/ so it
allows for nice visualizations of the benchmark results in github pages and produces warnings on PRs if the benchmarks regress.
9 changes: 9 additions & 0 deletions bench/derivative.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function benchmark_caputo(tag::String, end_tag::String, step_size::Real)
SUITE["fracdiff"]["cpu"][tag][end_tag] = @benchmarkable fracdiff(x->x^2, 0.5, 1, $step_size, CaputoDiethelm())
SUITE["fracdiff"]["cpu"][tag][end_tag] = @benchmarkable fracdiff(x->x^2, 0.5, 1, $step_size, CaputoL1())
end

function benchmark_RL(tag::String, end_tag::String, step_size::Real)
SUITE["fracdiff"]["cpu"][tag][end_tag] = @benchmarkable fracdiff(x->x^2, 0.5, 1, $step_size, RLD())
SUITE["fracdiff"]["cpu"][tag][end_tag] = @benchmarkable fracdiff(x->x^2, 0.5, 1, $step_size, RLDiffL1())
end
Loading