Hi Stephanie,
Are you on the latest GitHub version? You can get on it with
Pkg.checkout("ApproxFun")
Sent from my iPad
> On 20 Jun 2014, at 3:19 am, 'Stéphane Laurent' via julia-users
> <[email protected]> wrote:
>
> Hello Sheehan,
>
> I get this error when I run your code:
>
> julia> for k=1:5
> u=u-[B,L+gp(u)]\[0.,0.,L*u+g(u)-1.];
> end
> ERROR: Reducing over an empty array is not allowed.
> in _mapreduce at reduce.jl:151
> in mapreduce at reduce.jl:173
> in old_addentries! at
> /home/sdl/.julia/v0.3/ApproxFun/src/Operators/OperatorAlgebra.jl:106
> in addentries! at
> /home/sdl/.julia/v0.3/ApproxFun/src/Operators/OperatorAlgebra.jl:141
> in ShiftArray at
> /home/sdl/.julia/v0.3/ApproxFun/src/Operators/ShiftArray.jl:16
> in BandedArray at
> /home/sdl/.julia/v0.3/ApproxFun/src/Operators/ShiftArray.jl:110
> in getindex at /home/sdl/.julia/v0.3/ApproxFun/src/Operators/Operator.jl:46
> in getindex at
> /home/sdl/.julia/v0.3/ApproxFun/src/Operators/AlmostBandedOperator.jl:133
> in backsubstitution! at
> /home/sdl/.julia/v0.3/ApproxFun/src/Operators/adaptiveqr.jl:78
> in ultraiconversion at
> /home/sdl/.julia/v0.3/ApproxFun/src/Operators/Operator.jl:71
> in * at /home/sdl/.julia/v0.3/ApproxFun/src/Operators/Operator.jl:97
> in anonymous at no file:2
>
>
> Le mercredi 11 juin 2014 23:27:52 UTC+2, Sheehan Olver a écrit :
>>
>> Hi Stèphane,
>>
>> Nonlinear is not built in, but it’s easy enough to do by hand with
>> Newton iteration in function space. Let me know if there is any confusion
>> with the code below. I suppose I could just add a “nonlinsolve” routine
>> that bundles this up.
>>
>> (I am on the latest branch so this may or may not work on the 0.0.1
>> tag.)
>>
>>
>> Cheers,
>>
>> Sheehan
>>
>>
>>
>> x=Fun(identity,[-1.,1.])
>> d=x.domain
>> B=dirichlet(d)
>> D=diff(d)
>>
>> # Sets up L and g for equation in the form Lu + g(u)-1==0
>>
>> L=D^2 + 2(1-x.^2)*D
>> g=u->u.^2;gp=u->2u
>>
>> u=0.x # initial guess for the solution is zero
>>
>> for k=1:5
>> u=u-[B,L+gp(u)]\[0.,0.,L*u+g(u)-1.];
>> end
>>
>> norm(diff(u,2) + 2(1-x.^2).*diff(u) + g(u) -1) # This equals 0.0
>>
>>
>>> On 12 Jun 2014, at 1:02 am, 'Stéphane Laurent' via julia-users
>>> <[email protected]> wrote:
>>>
>>> Hello Sheehan,
>>>
>>> I have unsuccessfully tried to understand how works the differential
>>> equation solver (I do not understand the Airy example).
>>>
>>> It would be nice to have an example of code for a simple BVP such as :
>>>
>>> u" + 2(1-x^2)u + u^2 = 1 , u(-1) = u(1) = 0
>>>
>>> Regards,
>>> Stéphane
>>>
>>> Le lundi 24 mars 2014 02:04:25 UTC+1, Sheehan Olver a écrit :
>>>>
>>>>
>>>> I tagged a new release for ApproxFun
>>>> (https://github.com/dlfivefifty/ApproxFun) with major new features that
>>>> might interest people. Below are ODE solving and random number sampling
>>>> examples, find more in ApproxFun/examples. The code is meant as alpha
>>>> quality, so don't expect too much beyond the examples. There is
>>>> rudimentary support for PDE solving (e.g. Helmholtz in a square), but it's
>>>> reliability is limited without a better Lyapanov solver
>>>> (https://github.com/JuliaLang/julia/issues/5814).
>>>>
>>>> Cheers,
>>>>
>>>> Sheehan
>>>>
>>>>
>>>>
>>>>
>>>> Pkg.add("ApproxFun")
>>>> using ApproxFun
>>>>
>>>> ODE Solving: solve the Airy equation on [-1000,10]
>>>>
>>>> x=Fun(identity,[-2000.,10.])
>>>> d=x.domain
>>>> D=diff(d)
>>>> ai=[dirichlet(d),D^2 - x]\[airyai(-2000.),0.]
>>>> plot(ai)
>>>>
>>>>
>>>>
>>>>
>>>> Random number sampling: Sample a 2D Cauchy distribution on (-∞,∞)^2
>>>>
>>>> f = Fun2D((x,y)->1./(2π.*(x.^2 .+ y.^2 .+ 1).^(3/2)),Line(),Line())
>>>> r = sample(f,100)
>>