Skip to content

Commit

Permalink
Merge pull request #242 from ApproxFun/revert-241-feat-new
Browse files Browse the repository at this point in the history
Revert "Remove Disk"
  • Loading branch information
dlfivefifty committed Sep 6, 2015
2 parents 58aafbc + 0f5ef66 commit 8951189
Show file tree
Hide file tree
Showing 82 changed files with 1,356 additions and 1,941 deletions.
34 changes: 20 additions & 14 deletions .travis.yml
@@ -1,14 +1,20 @@
# Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia
os:
- linux
- osx
julia:
- release
- nightly
notifications:
email: false
# uncomment the following lines to override the default test script
#script:
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
# - julia -e 'Pkg.clone(pwd()); Pkg.build("MyPackage"); Pkg.test("MyPackage"; coverage=true)'
language: cpp
compiler:
- clang
notifications:
email: false
env:
matrix:
- JULIAVERSION="juliareleases"
- JULIAVERSION="julianightlies"
before_install:
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
- sudo add-apt-repository ppa:staticfloat/${JULIAVERSION} -y
- sudo apt-get update -qq -y
- sudo apt-get install libpcre3-dev julia -y
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
script:
- julia -e 'Pkg.init(); Pkg.clone(pwd()); Pkg.test("ApproxFun", coverage=true)'

after_success:
- julia -e 'cd(Pkg.dir("ApproxFun")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
20 changes: 20 additions & 0 deletions README.md
Expand Up @@ -167,6 +167,15 @@ u = [dirichlet(d);lap(d)+100I]\ones(4) # First four entries of rhs are
ApproxFun.contour(u) # Requires Gadfly or PyPlot
```
The following solves Poisson `Δu =f` with zero Dirichlet conditions
on a disk
```julia
d = Disk()
f = Fun((x,y)->exp(-10(x+.2)^2-20(y-.1)^2),d)
u = [dirichlet(d);lap(d)]\Any[0.,f]
ApproxFun.plot(u) # Requires Gadfly or PyPlot
```
We can also evolve PDEs. The following solves advection—diffusion
`u_t = 0.01Δu - 4u_x -3u_y` on a rectangle
Expand All @@ -181,6 +190,17 @@ h = 0.002
timeevolution(B,L,u0,h) # Requires GLPlot
```
The following solves beam equation `u_tt + Δ^2u = 0`
on a disk
```julia
d = Disk()
u0 = Fun((x,y)->exp(-50x^2-40(y-.1)^2)+.5exp(-30(x+.5)^2-40(y+.2)^2),d)
B= [dirichlet(d),neumann(d)]
L = -lap(d)^2
h = 0.001
timeevolution(2,B,L,u0,h) # Requires GLPlot
```
# High precision
Expand Down
1 change: 0 additions & 1 deletion REQUIRE
@@ -1,2 +1 @@
julia 0.3
Compat
10 changes: 0 additions & 10 deletions examples/Newton iteration for Nonlinear BVPs.jl

This file was deleted.

794 changes: 418 additions & 376 deletions examples/Time Evolution PDEs on Square (Gadfly).ipynb

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions src/ApproxFun.jl
@@ -1,20 +1,14 @@
VERSION >= v"0.4.0-dev+6641" && __precompile__()

module ApproxFun
using Base, Compat


import Base: values,getindex,setindex!,*,.*,+,.+,-,.-,==,<,<=,>,
>=,./,/,.^,^,\,,transpose


export pad!,pad,sample,chop!,complexroots,roots,svfft
export multiplybyx,fasttimes

##Testing
export bisectioninv, clenshaw


import Base.values



Expand Down Expand Up @@ -47,3 +41,5 @@ include("Extras/Extras.jl")


end #module


26 changes: 0 additions & 26 deletions src/Domains/Arc.jl
Expand Up @@ -46,30 +46,4 @@ fromcanonical(a::Arc,x)=mobiusinv(a,x)
fromcanonicalD(a::Arc,x)=mobiusinvD(a,x)


## information

Base.issubset(a::Arc,b::Arc)=a.centre==b.centre && a.radius==b.radius && (b.angles[1]a.angles[1]a.angles[2]b.angles[2] ||
b.angles[1]a.angles[1]a.angles[2]b.angles[2])


# Algebra

for op in (:*,:.*)
@eval begin
$op(c::Real,d::Arc)=Arc(c*d.center,c*d.radius,(sign(c)*d.angles[1],sign(c)*d.angles[2]))
$op(d::Arc,c::Real)=$op(c,d)
end
end

for op in (:+,:-,:.+,:.-)
@eval begin
$op(c::Number,d::Arc)=Arc($op(c,d.center),d.radius,d.angles)
$op(d::Arc,c::Number)=Arc($op(d.center,c),d.radius,d.angles)
end
end

# allow exp(im*Interval(0,1)) for constructing arc
function Base.exp{CMP<:Complex}(d::Interval{CMP})
@assert isapprox(real(d.a),0.) && isapprox(real(d.b),0.)
Arc(0.,1.,(imag(d.a),imag(d.b)))
end
2 changes: 1 addition & 1 deletion src/Domains/Circle.jl
Expand Up @@ -40,7 +40,7 @@ canonicaldomain(d::Circle)=PeriodicInterval()
Base.in(z,d::Circle)=isapprox(abs(z-d.center),d.radius)

Base.length(d::Circle) = 2π*d.radius
complexlength(d::Circle)=im*length(d) #TODO: why?



==(d::Circle,m::Circle) = d.center == m.center && d.radius == m.radius
Expand Down
9 changes: 3 additions & 6 deletions src/Domains/Curve.jl
Expand Up @@ -4,15 +4,13 @@

export Curve

immutable Curve{S<:FunctionSpace,T} <: UnivariateDomain{T}
curve::Fun{S,T}
immutable Curve{S<:FunctionSpace} <: Domain
curve::Fun{S}
end

==(a::Curve,b::Curve)=a.curve==b.curve

points(c::Curve,n)=c.curve[points(domain(c.curve),n)]
checkpoints(d::Curve)=fromcanonical(d,checkpoints(domain(d.curve)))

for op in (:(Base.first),:(Base.last),:(Base.rand))
@eval $op(c::Curve)=c.curve[$op(domain(c.curve))]
end
Expand All @@ -29,7 +27,6 @@ function tocanonical(c::Curve,x)
end


fromcanonicalD(c::Curve,x)=differentiate(c.curve)[x]
fromcanonicalD(c::Curve,x)=diff(c.curve)[x]


Base.in(x,d::Curve)=in(tocanonical(d,x),canonicaldomain(d))
6 changes: 0 additions & 6 deletions src/Domains/Domains.jl
Expand Up @@ -50,9 +50,3 @@ end

Base.promote_rule{D<:Domain,T<:Number}(::Type{D},::Type{Vector{T}})=UnivariateDomain{T}
Base.promote_rule{D<:PeriodicDomain,T<:Number}(::Type{D},::Type{Vector{T}})=PeriodicDomain{T}



Base.issubset(a::PeriodicInterval,b::Interval)=Interval(a.a,a.b)b
Base.issubset(a::Interval,b::PeriodicInterval)=aPeriodicInterval(b.a,b.b)
Base.issubset{T<:Real}(a::Interval{T},b::PiecewiseInterval{T})=aInterval(first(b.points),last(b.points))
15 changes: 5 additions & 10 deletions src/Domains/Interval.jl
Expand Up @@ -38,10 +38,7 @@ Base.convert{IT<:Interval}(::Type{IT},::AnyDomain)=AnyInterval()

Base.first(d::Interval)=d.a
Base.last(d::Interval)=d.b
Base.isempty(d::Interval)=isapprox(d.a,d.b;atol=200eps(eltype(d)))

Base.issubset(a::Interval,b::Interval)=first(a)b && last(a)b

Base.isempty(d::Interval)=isapprox(d.a,d.b)


## Map interval
Expand Down Expand Up @@ -101,26 +98,24 @@ Base.sqrt(d::Interval)=Interval(sqrt(d.a),sqrt(d.b))

Base.reverse(d::Interval)=Interval(d.b,d.a)

function Base.intersect{T<:Real,V<:Real}(a::Interval{T},b::Interval{V})
function Base.intersect(a::Interval{Float64},b::Interval{Float64})
if first(a) > last(a)
intersect(reverse(a),b)
elseif first(b) > last(b)
intersect(a,reverse(b))
elseif first(a) > first(b)
intersect(b,a)
elseif last(a) <= first(b)
EmptyDomain()
[]
elseif last(a)>=last(b)
b
elseif isapprox(first(b),last(a);atol=100eps(promote_type(T,V))/max(length(a),length(b)))
EmptyDomain()
else
Interval(first(b),last(a))
end
end


function Base.setdiff{T<:Real,V<:Real}(a::Interval{T},b::Interval{V})
function Base.setdiff(a::Interval{Float64},b::Interval{Float64})
# ensure a/b are well-ordered
if first(a) > last(a)
intersect(reverse(a),b)
Expand All @@ -138,7 +133,7 @@ function Base.setdiff{T<:Real,V<:Real}(a::Interval{T},b::Interval{V})
if first(a)>=last(b)
a
elseif last(a) <= last(b)
EmptyDomain()
[]
else #first(b) < first(a) < last(b) < last(a)
Interval(last(b),last(a))
end
Expand Down

0 comments on commit 8951189

Please sign in to comment.