Skip to content

Commit

Permalink
move test of FD + reli to ni loop, fix error in derivative
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 committed Jun 3, 2024
1 parent f8c996e commit 8390cc0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/PolyLogForwardDiffExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ end

function PolyLog.reli(n::Integer,d::Dual{T}) where T
val = ForwardDiff.value(d)
x = reli(val)
x = reli(n,val)
dx = PolyLog.reli(n-1,val)/val
return Dual{T}(x, dx*partials(d))
end
Expand Down
4 changes: 3 additions & 1 deletion test/Li.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ end
@test PolyLog.li(n, 1//1 + 0//1im) zeta
@test PolyLog.li(n, 1 + 0im) zeta
@test PolyLog.li(n, BigFloat("1.0") + 0im) == PolyLog.zeta(n, BigFloat)

@test ForwardDiff.derivative(Base.Fix1(PolyLog.reli,n),float(pi)) == PolyLog.reli(n,float(pi))/float(pi)
end

# value close to boundary between series 1 and 2 in arXiv:2010.09860
Expand Down Expand Up @@ -130,5 +132,5 @@ end
end

#ForwardDiff Test
@test ForwardDiff.derivative(Base.Fix1(PolyLog.reli,6),float(pi)) == PolyLog.reli(5,float(pi))/float(pi)

end

0 comments on commit 8390cc0

Please sign in to comment.