desolve_system where boundary values are functions of the dependent variable

i like this post (click again to cancel)
0
i dont like this post (click again to cancel)

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?

reset()
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)
view(sol)
# 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)

asked Jun 06 '12

Daniel Farrell gravatar image Daniel Farrell
3 3

updated Jun 06 '12

i like this answer (click again to cancel)
2
i dont like this answer (click again to cancel) Daniel Farrell has selected this answer as correct
reset()
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)
sol1=sol1.subs(c=c1)
sol2=sol2.subs(c=c2) 
e1=sol1.subs(x=0)==A*sol2.subs(x=0)+C
e2=sol2.subs(x=D)==B*sol1.subs(x=D)
sol=solve([e1,e2],[c1,c2])
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))
link

posted Jun 06 '12

achrzesz gravatar image achrzesz
1661 4 16 36

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

Daniel Farrell (Jun 06 '12)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Tags:

Stats:

Asked: Jun 06 '12

Seen: 55 times

Last updated: Jun 06 '12

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.