Skip to content

Commit

Permalink
Fix #701
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Apr 25, 2020
1 parent ab53cc6 commit ea9b07d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ApproxFun"
uuid = "28f2ccd6-bb30-5033-b560-165f7b14dc2f"
version = "0.11.12"
version = "0.11.13"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
5 changes: 3 additions & 2 deletions src/Extras/autodifferentiation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ domain(df::DualFun) = domain(df.f)
differentiate(d::DualFun) = DualFun(d.f',Derivative(rangespace(d.J))*d.J)
integrate(d::DualFun) = DualFun(integrate(d.f),Integral(rangespace(d.J))*d.J)
function cumsum(d::DualFun)
Q=Integral(rangespace(d.J))*d.J
DualFun(cumsum(d.f),(I-Evaluation(rangespace(Q),leftendpoint))*Q)
Q = Integral(rangespace(d.J))*d.J
rs = rangespace(Q)
DualFun(cumsum(d.f),Q-ones(rs)*Evaluation(rs,leftendpoint)*Q)
end

# total definite integral of a function
Expand Down
6 changes: 5 additions & 1 deletion test/ExtrasTest.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ApproxFun, Test, DualNumbers
import ApproxFun: eigs
import ApproxFun: eigs

@testset "Extras" begin
@testset "Dual numbers" begin
Expand Down Expand Up @@ -123,6 +123,10 @@ using ApproxFun, Test, DualNumbers
u = 0.5*one(x)
u = newton(N_single, [u])
@test norm(u - u1) < 1e-15
end

@testset "cumsum (#701)" begin
d = ApproxFun.DualFun(Fun())
@test cumsum(d).J*Fun() Fun(x -> (x^2-1)/2)
end
end

2 comments on commit ea9b07d

@dlfivefifty
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 created: JuliaRegistries/General/13668

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.11.13 -m "<description of version>" ea9b07d883e7446e5b0fffc37af82f43cb2d7544
git push origin v0.11.13

Please sign in to comment.