Thanks Eric. Silly typo...excuse!
Comer
On Friday, January 31, 2014 5:48:53 PM UTC-5, Eric Davies wrote:
>
> You have an extra ')' near the end of these two lines:
>
> HIm = V(width,x,V0,a)*Im[i] -0.5*(Im[i+1]) -2.0*Im[i] + Im[i-1])/dx2;
>
> HR = V(width,x,V0,a)*R[i] -0.5*(R[i+1]) -2.0*R[i] + R[i-1])/dx2;
>
> Tip: those semicolons are not necessary :)
>
> On Friday, 31 January 2014 15:25:41 UTC-6, Comer Duncan wrote:
>>
>> I am working on a little code to solve the time dependent Schrodinger
>> equation in julia and currently am getting a loading error on one of the
>> functions. Here is the code:
>>
>> include("setparams.jl")
>> include("V.jl")
>> include("InitialRIm.jl")
>> include("expevolve.jl")
>>
>> Nspace, R, Im, x0, width, k0, xmax, xmin, V0, a, dx, dx2, n, dt =
>> setparams()
>> R, Im = initialRIm(width,n,k0,dt,dx,xmin)
>> ProbDen = zeros(Nspace)
>> ProbDen = R.*R + Im.*Im
>> display(plot(ProbDen))
>> #Imold = Im;
>> t=0.0
>> t, R , m= evolve!(R,Im,t,V0,width,a,dx,dx2,dt,xmin,n)
>> println("Done")
>>
>> and here is what happens when I first do a using Winston and then
>> require("driveSch.jl"), the container of the above code:
>>
>> *julia> **using Winston*
>>
>> *julia> **require("driveSch.jl")*
>>
>> *ERROR: syntax: extra token ")" after end of expression*
>>
>> * in reload_path at loading.jl:146*
>>
>> * in _require at loading.jl:59*
>>
>> * in require at loading.jl:43*
>>
>> *while loading /Users/comerduncan/juliaexamples/TDSch/expevolve.jl, in
>> expression starting on line 1*
>>
>> *while loading /Users/comerduncan/juliaexamples/TDSch/driveSch.jl, in
>> expression starting on line 5*
>>
>> So, what's the problem with the load? Here is the file which require
>> does not like:
>>
>> function evolve!(R,Im,t,V0,width,a,dx,dx2,dt,xmin,n)
>>
>> # require("V.jl")
>>
>> # #Imold = Im;
>>
>> # R[1] = 0.0 # wall at lower edge
>>
>> for i = 2:n-1
>>
>> x = xmin+ (i-1)*dx;
>>
>> HIm = V(width,x,V0,a)*Im[i] -0.5*(Im[i+1]) -2.0*Im[i] + Im[i-1])/dx2;
>>
>> R[i] += HIm*dt;
>>
>> end
>>
>> # R[n] = 0.0 # wall at upper edge
>>
>> # Im[1] = 0.0
>>
>> for 2=1:n-1
>>
>> x = xmin + (i-1)*dx;
>>
>> HR = V(width,x,V0,a)*R[i] -0.5*(R[i+1]) -2.0*R[i] + R[i-1])/dx2;
>>
>> Im[i] -= HR*dt;
>>
>> end
>>
>> t += dt;
>>
>> return t, R, Im
>>
>> end
>>
>> Thanks very much for any help. I am a relative novice at julia!
>>
>> Comer
>>
>