Ah my apologies - Haskell is my main language and I am used to being told that 
I have missed an argument and I still haven’t got my head round Julia’s type 
system.

> julia> typeof(Fun)
> DataType

> julia> help(Fun)
> DataType   : ApproxFun.Fun{S<:ApproxFun.FunctionSpace{T,D},T<:Number}
>   supertype: Any
>   fields   : [:coefficients,:space]

It would be nice if julia told you what arguments a function required. Perhaps 
it does and I just don’t know how to ask it nicely.

Anyway the good news is that I get a very accurate answer (since I know the 
answer analytically in this case). Thanks for your help and for a great package.

Dominic Steinitz
[email protected]
http://idontgetoutmuch.wordpress.com

On 22 Mar 2015, at 09:25, Sheehan Olver <[email protected]> wrote:

> You can do the following
> 
>     d = Interval(0,1)
>     f1 = Fun(x->0,d)
>     f2 = Fun(x->1 / ((1 + x)^2 + 1),d)
>     f3 = Fun(y->y / (1 + y^2),d)
>     f4 = Fun(y->y / (4 + y^2),d)
> 
>     u = [dirichlet(d^2),lap(d^2)]\[f1,f2,f3,f4]
> 
> 
> 
>> On 22 Mar 2015, at 7:35 pm, Dominic Steinitz <[email protected]> wrote:
>> 
>> Ah thanks - that produces an answer. However I want the boundary conditions 
>> to be on [0,1]^2. I tried
>> 
>>> dd = (domain(Fun(identity,[0.0,1.0])))^2
>> 
>> 
>>> u = [dirichlet(dd),lap(dd)]\[f1,f2,f3,f4]
>> 
>> 
>> but this gives me
>> 
>>> julia> u = [dirichlet(dd),lap(dd)]\[f1,f2,f3,f4]
>>> WARNING: [a,b] concatenation is deprecated; use [a;b] instead
>>>  in depwarn at 
>>> /Applications/Julia-0.4.0-dev-5587ca352f.app/Contents/Resources/julia/lib/julia/sys.dylib
>>>  in oldstyle_vcat_warning at 
>>> /Applications/Julia-0.4.0-dev-5587ca352f.app/Contents/Resources/julia/lib/julia/sys.dylib
>>>  in vect at abstractarray.jl:35
>>> ERROR: AssertionError: domainscompatible(a,b)
>>>  in conversion_rule at 
>>> /Users/dom/.julia/v0.4/ApproxFun/src/Spaces/Ultraspherical/UltrasphericalOperators.jl:313
>>>  in conversion_type at 
>>> /Users/dom/.julia/v0.4/ApproxFun/src/Fun/FunctionSpace.jl:146
>>>  in coefficients at 
>>> /Users/dom/.julia/v0.4/ApproxFun/src/Fun/FunctionSpace.jl:233
>>>  in * at /Users/dom/.julia/v0.4/ApproxFun/src/Operators/algebra.jl:398
>>>  in cont_reduce_dofs! at 
>>> /Users/dom/.julia/v0.4/ApproxFun/src/PDE/cont_lyap.jl:20
>>>  in cont_reduce_dofs! at 
>>> /Users/dom/.julia/v0.4/ApproxFun/src/PDE/cont_lyap.jl:64
>>>  in cont_constrained_lyap at 
>>> /Users/dom/.julia/v0.4/ApproxFun/src/PDE/cont_lyap.jl:297
>>>  in pdesolve at /Users/dom/.julia/v0.4/ApproxFun/src/PDE/pdesolve.jl:127
>>>  in pdesolve at /Users/dom/.julia/v0.4/ApproxFun/src/PDE/pdesolve.jl:126
>>>  in pdesolve at /Users/dom/.julia/v0.4/ApproxFun/src/PDE/pdesolve.jl:101
>>>  in \ at /Users/dom/.julia/v0.4/ApproxFun/src/PDE/pdesolve.jl:138
>> 
>> 
>> I am not clear which domains are incompatible.
>> 
>> Dominic Steinitz
>> [email protected]
>> http://idontgetoutmuch.wordpress.com
>> 
>> On 22 Mar 2015, at 02:25, Sheehan Olver <[email protected]> wrote:
>> 
>>> 
>>> It's expanding f1-f4 as bivariate functions on [-1,1]^2, but instead you 
>>> want to expand them as univariate functions on [-1,1]:
>>> 
>>> d = Interval()^2
>>> 
>>> f1 = Fun(x->0)
>>> f2 = Fun(x->1 / ((1 + x)^2 + 1))
>>> f3 = Fun(y->y / (1 + y^2))
>>> f4 = Fun(y->y / (4 + y^2))
>>> 
>>> u = [dirichlet(d),lap(d)]\[f1,f2,f3,f4]
>>> 
>>> 
>>> 
>>> On Sunday, March 22, 2015 at 8:02:45 AM UTC+11, idontgetoutmuch wrote:
>>> 
>>> 
>>> I am trying to solve Laplace's equation using ApproxFun with the following 
>>> boundary conditions
>>> 
>>> {
>>> \phi(x, 0) &= 0 \\
>>> \phi(x, 1) &= \frac{1}{(1 + x)^2 + 1} \\
>>> \phi(0, y) &= \frac{y}{1 + y^2} \\
>>> \phi(1, y) &= \frac{y}{4 + y^2}
>>> \end{aligned}
>>> }
>>> 
>>> I'm not clear how to express these. I've tried
>>> 
>>> {
>>> d = Interval()^2
>>> 
>>> f1 = Fun((x,y)->0)
>>> f2 = Fun((x,y)->1 / ((1 + x)^2 + 1))
>>> f3 = Fun((x,y)->y / (1 + y^2))
>>> f4 = Fun((x,y)->y / (4 + y^2))
>>> 
>>> u = [dirichlet(d),lap(d)]\[f1,f2,f3,f4]
>>> }
>>> 
>>> and
>>> 
>>> {
>>> u = [dirichlet(d),lap(d)]\[zeros(1),f2,f3,f4]
>>> }
>>> 
>>> but in both cases I get errors (which I can attach).
>>> 
>>> I can see ldirichlet and rdirichlet exist but I need to specify the top and 
>>> bottom as well.
>> 
> 

Reply via email to