Code Monkey home page Code Monkey logo

scifracx / fractionalcalculus.jl Goto Github PK

View Code? Open in Web Editor NEW
29.0 2.0 6.0 4.8 MB

FractionalCalculus.jl: A Julia package for high performance, comprehensive and high precision numerical fractional calculus computing.

Home Page: http://scifracx.org/FractionalCalculus.jl/dev/

License: MIT License

Julia 100.00%
julia fractional-calculus riemann-liouville grunwald-letnikov numerical caputo differintegral algorithms differentiation integration

fractionalcalculus.jl's Introduction

FractionalCalculus.jl

building codecov license license DOI GitHub issues GitHub stars GitHub forks

FractionalCalculus.jl provides support for fractional calculus computing.

πŸŽ‡ Installation

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

pkg> add FractionalCalculus

🦸 Quick start

Derivative

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> 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 $f(x) = x$ in $x = 1$ with step size $h = 0.0001$ using Riemann-Liouville sense:

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

This will return the estimated value with high precision.

πŸ’» All algorithms

Current Algorithms
β”œβ”€β”€ FracDiffAlg
β”‚   β”œβ”€β”€ Caputo
|   |   β”œβ”€β”€ CaputoDirect
|   |   β”œβ”€β”€ CaputoTrap
|   |   β”œβ”€β”€ CaputoDiethelm
|   |   β”œβ”€β”€ CaputoHighPrecision
|   |   β”œβ”€β”€ CaputoL1
|   |   β”œβ”€β”€ CaputoL2
|   |   └── CaputoHighOrder
|   |
β”‚   β”œβ”€β”€ GrΓΌnwald Letnikov
|   |   β”œβ”€β”€ GLDirect
|   |   β”œβ”€β”€ GLMultiplicativeAdditive
|   |   β”œβ”€β”€ GLLagrangeThreePointInterp
|   |   └── GLHighPrecision
|   |
|   β”œβ”€β”€ Riemann Liouville
|   |    β”œβ”€β”€ RLDiffL1
|   |    β”œβ”€β”€ RLDiffL2
|   |    β”œβ”€β”€ RLDiffL2C
|   |    β”œβ”€β”€ RLLinearSplineInterp
|   |    β”œβ”€β”€ RLDiffMatrix
|   |    β”œβ”€β”€ RLG1
|   |    └── RLD
|   | 
|   β”œβ”€β”€ Hadamard
|   |    β”œβ”€β”€ HadamardLRect
|   |    β”œβ”€β”€ HadamardRRect
|   |    └── HadamardTrap
|   |
|   β”œβ”€β”€ Riesz
|   |    β”œβ”€β”€ RieszSymmetric
|   |    └── RieszOrtigueira
|   |
|   β”œβ”€β”€ Caputo-Fabrizio
|   |    └── CaputoFabrizioAS
|   |
|   └── Atanagana Baleanu
|        └── AtanganaSeda
|
└── FracIntAlg
    β”œβ”€β”€ Riemann Liouville
    |   β”œβ”€β”€ RLDirect
    |   β”œβ”€β”€ RLPiecewise
    |   β”œβ”€β”€ RLLinearInterp
    |   β”œβ”€β”€ RLIntApprox
    |   β”œβ”€β”€ RLIntMatrix
    |   β”œβ”€β”€ RLIntSimpson
    |   β”œβ”€β”€ RLIntTrapezoidal
    |   β”œβ”€β”€ RLIntRectangular
    |   └── RLIntCubicSplineInterp
    |
    └── Hadamard
        └── HadamardMat

For detailed usage, please refer to our manual.

πŸ–ΌοΈ Example

Let's see examples here:

Compute the semi-derivative of $f(x) = x$ in the interval $\left[0, 1\right]$:

Plot

We can see that computing retains high precision⬆️.

Compute different order derivative of $f(x) = x$:

Different Order

Also different order derivative of $f(x) = \sin(x)$:

Different Order of sin

And also different order integral of $f(x) = x$:

Different Order Of x

πŸ§™ Symbolic Fractional Differentiation and Integration

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

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:

Fractional Derivative:

  • Caputo fractional derivative
  • Grunwald-Letnikov fractional derivative
  • Riemann-Liouville fractional derivative
  • Riesz fractional derivative
  • Hadamard fractional derivative
  • Caputo-Fabrizio fractional derivative
  • Atangana-Baleanu fractional derivative
  • Marchaud fractional derivative
  • Weyl fractional derivative
  • ......

Fractional Integral:

  • Riemann-Liouville fractional integral
  • Hadamard fractional integral
  • Atangana-Baleanu fractional integral
  • ......

πŸ“š 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.

πŸ₯‚ Contributing

If you are interested in Fractional Calculus and Julia, welcome to raise an issue or file a Pull Request!!

fractionalcalculus.jl's People

Contributors

erikqqy avatar github-actions[bot] avatar jefffessler avatar pedromxavier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fractionalcalculus.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Numerical error too high

I'm doing the most simple Caputo derivative
$$^C_0 D_t^\alpha t = \frac{t^{1-\alpha}}{\Gamma(2-\alpha)}$$
and I get a relative error of $0.024$ for a time step of $10^{-9}$, is this supposed to be working properly?

using FractionalCalculus
using SpecialFunctions: gamma

T = 0.6; Ξ± = 0.9; Ξ”t = 1e-9
numerical_caputo_der = fracdiff(t->t,Ξ±,0,T,Ξ”t,CaputoDirect())[1]
theoretical_caputo_der = T^(1-Ξ±)/gamma(2-Ξ±)
abs(numerical_caputo_der-theoretical_caputo_der)/abs(theoretical_caputo_der) # 0.0239

Examples on FractionalCalculus doc page returned error in Julia 1.9.2

Examples on the FractionalCalculus.jl home page are returning functions not defined in Julia 1.9.2. For instance,

julia> fracdiff(x->x, 0.5, 1, 0.0001, RLDiffL1())
ERROR: UndefVarError: RLDiffL1 not defined
Stacktrace:
[1] top-level scope
@ REPL[2]:1

Another example:

julia> semidiff(log(x))
ERROR: UndefVarError: semidiff not defined
Stacktrace:
[1] top-level scope
@ REPL[5]:1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.