JuliaDiff / JuliaDiff/FiniteDifferences.jl
Improve accuracy by using Twitter
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 318
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
Ever approximate a derivative in code with:
h = 0.001
df(x) = (f(x + h) - f(x)) / hIt turns out that this has some pretty serious issues with values that can't be represented in binary. But this simple fix can correct that
temp = x + h
h = temp - x
-- https://twitter.com/willkurt/status/1330183861452541953?s=20
@wesselb suggested to insert it here:
https://github.com/JuliaDiff/FiniteDifferences.jl/blob/master/src/methods.jl#L270
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/methods.jl around line 270, the insertion point suggested in the issue. Compare how the finite-difference step is computed with the linked derivative example, then use the repository's existing test suite to check that the adjusted step improves accuracy without changing other cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100