{"id":15057172,"url":"https://github.com/0samuraie/centraldiff.jl","last_synced_at":"2025-04-10T10:05:26.107Z","repository":{"id":250475668,"uuid":"834566246","full_name":"0samuraiE/CentralDiff.jl","owner":"0samuraiE","description":"Higher-order central finite difference scheme","archived":false,"fork":false,"pushed_at":"2024-11-18T18:16:20.000Z","size":231,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T08:55:10.443Z","etag":null,"topics":["central-difference","discrete","julia"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0samuraiE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-27T16:54:39.000Z","updated_at":"2024-09-07T20:45:34.000Z","dependencies_parsed_at":"2025-02-16T23:32:39.449Z","dependency_job_id":"ea9487ac-da82-4a07-916f-9e4ce87bcdb9","html_url":"https://github.com/0samuraiE/CentralDiff.jl","commit_stats":null,"previous_names":["0samuraie/centerdiff.jl","0samuraie/centraldiff.jl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0samuraiE%2FCentralDiff.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0samuraiE%2FCentralDiff.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0samuraiE%2FCentralDiff.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0samuraiE%2FCentralDiff.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0samuraiE","download_url":"https://codeload.github.com/0samuraiE/CentralDiff.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198879,"owners_count":21063628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["central-difference","discrete","julia"],"created_at":"2024-09-24T22:03:24.601Z","updated_at":"2025-04-10T10:05:26.087Z","avatar_url":"https://github.com/0samuraiE.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CentralDiff.jl\n\n*Central difference in Julia*\n\n[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://0samuraiE.github.io/CentralDiff.jl/stable/)\n[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://0samuraiE.github.io/CentralDiff.jl/dev/)\n[![Build Status](https://github.com/0samuraiE/CentralDiff.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/0samuraiE/CentralDiff.jl/actions/workflows/CI.yml?query=branch%3Amaster)\n[![Coverage](https://codecov.io/gh/0samuraiE/CentralDiff.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/0samuraiE/CentralDiff.jl)\n\nCentralDiff.jl is a Julia module for performing central difference on multi-dimensional data. It provides tools to compute numerical derivatives and supports higher-order finite differences.\n\n## Features\n\n- Compute finite differences up to order 20 with zero-cost abstraction.\n- Support for multi-dimensional arrays.\n- Includes a Simple module for usage that does not require consistency.\n\n## Installation\n\nCentralDiff.jl can be installed with the Julia package manager. From the Julia REPL, type `]` to\nenter the Pkg REPL mode and run:\n```\npkg\u003e add https://github.com/0samuraiE/CentralDiff.jl.git\n```\n\n## Usage\n```julia\njulia\u003e using CentralDiff\n\njulia\u003e f(x) = x^2;\n\njulia\u003e fc(Order(4), f.(1:4)) # The analytical solution is 2.5^2=6.25\n6.25\n\njulia\u003e dfdxc(Order(6), f.(1:6), 1) # The analytical solution is 2*3.5=7.0\n7.0\n\njulia\u003e dfdx(Order(4), f.(1:7), 1) # The analytical solution is 2*4.0=8.0\n7.999999999999999\n\njulia\u003e d2fdx(Order(4), f.(1:7), 1) # The analytical solution is 2\n1.999999999999998\n\njulia\u003e Simple.dfdx(Order(4), f.(1:5), 1) # The analytical solution is 2*3.0=6.0\n5.999999999999999\n\njulia\u003e Simple.d2fdx(Order(4), f.(1:5), 1) # The analytical solution is 2\n1.9999999999999991\n```\n\n## Advanced Usage\n```julia\njulia\u003e g̃((x, y, z)) = sin(x) * sin(y) * sin(z);\n       dg̃dx((x, y, z)) = cos(x) * sin(y) * sin(z);\n       dg̃dy((x, y, z)) = sin(x) * cos(y) * sin(z);\n       dg̃dz((x, y, z)) = sin(x) * sin(y) * cos(z);\n       d2g̃dx((x, y, z)) = -sin(x) * sin(y) * sin(z);\n       d2g̃dy((x, y, z)) = -sin(x) * sin(y) * sin(z);\n       d2g̃dz((x, y, z)) = -sin(x) * sin(y) * sin(z);\n       X = Y = Z = range(0, 2π; length=64);\n       dx = dy = dz = step(X); dxi = dyi = dzi = 1 / dx;\n       MESH = collect(Iterators.product(X, Y, Z));\n       G = g̃.(MESH);\n       I0 = CartesianIndex(8, 8, 8);\n       x0, y0, z0 = MESH[I0];\n\njulia\u003e fc(Order(2), XAxis(), G, I0) - g̃((x0+dx/2, y0, z0))\n-0.0003493436613384304\n\njulia\u003e dfdxc(Order(4), YAxis(), G, I0, dyi) - dg̃dy((x0, y0+dy/2, z0))\n-1.4038190432330566e-7\n\njulia\u003e dfdx(Order(6), ZAxis(), G, I0, dzi) - dg̃dz((x0, y0, z0))\n-1.7355242798444692e-9\n\njulia\u003e d2fdx(Order(8), ZAxis(), G, I0, dzi) - d2g̃dz((x0, y0, z0))\n6.298850330210826e-13\n\njulia\u003e Simple.dfdx(Order(10), XAxis(), G, I0, dxi) - dg̃dx((x0, y0, z0))\n-1.1435297153639112e-14\n\njulia\u003e Simple.d2fdx(Order(12), XAxis(), G, I0, dxi) - d2g̃dx((x0, y0, z0))\n-1.27675647831893e-15\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0samuraie%2Fcentraldiff.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0samuraie%2Fcentraldiff.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0samuraie%2Fcentraldiff.jl/lists"}