From cb64c72de20a1270e750e0cf85294a8116f18de5 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 8 Aug 2022 22:59:23 +0530 Subject: [PATCH] fix dualnumbers real/eps part (#793) --- Project.toml | 2 +- README.md | 6 +++--- src/Extras/dualnumbers.jl | 4 ++-- test/ExtrasTest.jl | 4 ++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Project.toml b/Project.toml index 8bdac79bf..ef70cf007 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ApproxFun" uuid = "28f2ccd6-bb30-5033-b560-165f7b14dc2f" -version = "0.13.6" +version = "0.13.7" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c" diff --git a/README.md b/README.md index 55c2789d2..1cd765123 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaApproximation.github.io/ApproxFun.jl/stable) [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaApproximation.github.io/ApproxFun.jl/latest) -[![Build Status](https://travis-ci.org/JuliaApproximation/ApproxFun.jl.svg?branch=master)](https://travis-ci.org/JuliaApproximation/ApproxFun.jl) +[![Build Status](https://travis-ci.org/JuliaApproximation/ApproxFun.jl.svg?branch=master)](https://travis-ci.org/JuliaApproximation/ApproxFun.jl) [![Build status](https://ci.appveyor.com/api/projects/status/40qmoxp189pwtuda?svg=true)](https://ci.appveyor.com/project/dlfivefifty/approxfun-jl) [![codecov](https://codecov.io/gh/JuliaApproximation/ApproxFun.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaApproximation/ApproxFun.jl) [![Join the chat at https://gitter.im/JuliaApproximation/ApproxFun.jl](https://badges.gitter.im/JuliaApproximation/ApproxFun.jl.svg)](https://gitter.im/JuliaApproximation/ApproxFun.jl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -10,7 +10,7 @@ ApproxFun is a package for approximating functions. It is in a similar vein to the Matlab -package [`Chebfun`](http://www.chebfun.org) and the Mathematica package [`RHPackage`](https://github.com/dlfivefifty/RHPackage). +package [`Chebfun`](http://www.chebfun.org) and the Mathematica package [`RHPackage`](https://github.com/dlfivefifty/RHPackage). The [`ApproxFun Documentation`](https://JuliaApproximation.github.io/ApproxFun.jl/latest) contains detailed information, or read on for a brief overview of the package. @@ -197,7 +197,7 @@ d = ChebyshevInterval()^2 # Defines a rectangle Δ = Laplacian(d) # Represent the Laplacian f = ones(∂(d)) # one at the boundary u = \([Dirichlet(d); Δ+100I], [f;0.]; # Solve the PDE - tolerance=1E-5) + tolerance=1E-5) surface(u) # Surface plot ``` diff --git a/src/Extras/dualnumbers.jl b/src/Extras/dualnumbers.jl index 1a644a937..9668fcf51 100644 --- a/src/Extras/dualnumbers.jl +++ b/src/Extras/dualnumbers.jl @@ -2,8 +2,8 @@ real(::Type{Dual{T}}) where {T} = Dual{ApproxFun.real(T)} # Dual number support. Should there be realpart and dualpart of Space and Domain? -DualNumbers.realpart(f::Fun{S,T}) where {S,T<:Dual} = Fun(space(f),realpart(coefficients(f))) -DualNumbers.dualpart(f::Fun{S,T}) where {S,T<:Dual} = Fun(space(f),dualpart(coefficients(f))) +DualNumbers.realpart(f::Fun{S,T}) where {S,T<:Dual} = Fun(space(f),realpart.(coefficients(f))) +DualNumbers.dualpart(f::Fun{S,T}) where {S,T<:Dual} = Fun(space(f),dualpart.(coefficients(f))) DualNumbers.realpart(d::Segment{<:Dual}) = Segment(realpart(leftendpoint(d)),realpart(rightendpoint(d))) diff --git a/test/ExtrasTest.jl b/test/ExtrasTest.jl index 266511022..0589feda0 100644 --- a/test/ExtrasTest.jl +++ b/test/ExtrasTest.jl @@ -44,6 +44,10 @@ import ApproxFun: eigs ud = [B;D+a] \ [2.0,0.0] @test absdual(u(0.5) - dual(ur(0.5),ud(0.5))) < 10eps() end + + f=Fun(x->exp(dual(x,1)),-1..1) + @test coefficients(realpart(f)) == realpart.(coefficients(f)) + @test coefficients(dualpart(f)) == dualpart.(coefficients(f)) end @testset "Eig test #336" begin