Ask Your Question

desolve_system where boundary values are functions of the dependent variable

asked 2012-06-06 10:37:32 +0200

Daniel Farrell gravatar image

updated 2012-06-06 10:40:07 +0200

I am using desolve_system() to solve a boundary value problem. The equations are very simple but I'm having a bit of difficulty trying to include the boundary conditions. The system of equations and boundary conditions are,

System of differential equations with boundary values.

This is the code that I'm using in sage. How can I include the boundary values in this problem?

var('I_1 I_2 I0 R0 R1 x alpha D')
I_1 = function('I_1', x)
I_2 = function('I_2', x)
eq1 =  diff(I_1,x) == -alpha * I_1
eq2 = -diff(I_2,x) == -alpha * I_2
sol = desolve_system( [eq1, eq2], [I_1, I_2], ivar=x)
# How can I include these?
#BV1: I_1(x=0)==A*I_2(x=0) + C
#BV2: I_2(x=D)==B*I_1(x=D)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-06-06 16:37:44 +0200

achrzesz gravatar image
var('I_1 I_2 I0 A B C D c c1 c2 x alpha D')
I_1 = function('I_1', x)
I_2 = function('I_2', x)
eq1 =  diff(I_1,x) == -alpha * I_1
eq2 = -diff(I_2,x) == -alpha * I_2
sol1 = desolve( eq1,I_1,ivar=x)
sol2 = desolve( eq2,I_2,ivar=x)
print "I_1 =",sol1.subs(sol[0][0])
print "I_2 =",sol2.subs(sol[0][1])

#I_1 = -C*e^(2*D*alpha - alpha*x)/(A*B - e^(2*D*alpha))
#I_2 = -B*C*e^(alpha*x)/(A*B - e^(2*D*alpha))
edit flag offensive delete link more


Thank you very much, that's a very clever solution.

Daniel Farrell gravatar imageDaniel Farrell ( 2012-06-06 22:16:49 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-06-06 10:37:32 +0200

Seen: 898 times

Last updated: Jun 06 '12