# Revision history [back]

### Solving the Schrodinger equation using sage (Well)

Hi guys,

I'm trying to solve the Schrodinger equation through sage, for the potencial well.

## I have it:

var('k a ')

psi=function('psi')(x)

eqs=diff(psi,x,2)+k^(2)*psi==0

assume (k>0, a>0 )

EQS=function('EQS')(x)

EQS= desolve (eqs, psi, ivar=x )

var ('A B c')

result0= Acos(k0)+Bsin(k0)==0

result1= Bsin(ka)==0

assume (B>0)

You guys know how can i find the constants A and B through boundary conditions? My conditions are: Psi(0)=0 and Psi(a)=0, If a put it in desolve function it return me zero. So i tried to work with the equations separated but i cannot figure out how to get k=n*pi/a (the expected result)

 2 None slelievre 14559 ●16 ●136 ●287 http://carva.org/samue...

### Solving the Schrodinger equation using sage (Well)

Hi guys,

I'm trying to solve the Schrodinger Schrödinger equation through sage, Sage, for the potencial potential well.

## I have it:

wrote:

k, a = var('k, a')
psi = function('psi')(x)
eqs = diff(psi, x, 2) + k^(2)*psi == 0
assume(k > 0, a > 0)
EQS = function('EQS')(x)
EQS = desolve(eqs, psi, ivar=x)
A, B, c = var('A, B, c')
result0 = A*cos(k*0) + B*sin(k*0) == 0
result1 = B*sin(k*a) == 0
assume(B > 0)


var('k a ')

psi=function('psi')(x)

eqs=diff(psi,x,2)+k^(2)*psi==0

assume (k>0, a>0 )

EQS=function('EQS')(x)

EQS= desolve (eqs, psi, ivar=x )

var ('A B c')

result0= Acos(k0)+Bsin(k0)==0

result1= Bsin(ka)==0

assume (B>0)

You guys know how How can i find the constants A and B through boundary conditions? conditions?

My conditions are: Psi(0)=0 and Psi(a)=0, Psi(a)=0.

If a i put it in desolve function it return me zero. zero.

So i tried to work with the equations separated but i cannot figure out out how to get k=n*pi/a k=n*pi/a (the expected result)result).