I am trying to solve a differential equation. After solving it, I look for the coefficients according to some boundary conditions that give a certain system of algebraic equations. How can I place back into the general solution the roots of the algebraic system?
k = DSolve[{y'''[z] == -I*Betta*y'[z] + B}, y[z], z];
roots = Solve[
0 == c1 + c2*Cosh[I/2*(I*Betta)^0.5] +
c3/I*Sinh[I/2*(I*Betta)^0.5] + B/(2*I*Betta) &&
0 == c1 + c2*Cosh[I/2*(I*Betta)^0.5] -
c3/I*Sinh[I/2*(I*Betta)^0.5] - B/(2*I*Betta) &&
1 == c2*I*(I*Betta)^0.5*Sinh[I/2*(I*Betta)^0.5] +
c3*(I*Betta)^0.5*Cosh[I/2*(I*Betta)^0.5] + B/(I*Betta) &&
1 == -c2*I*(I*Betta)^0.5*Sinh[I/2*(I*Betta)^0.5] +
c3*(I*Betta)^0.5*Cosh[I/2*(I*Betta)^0.5] + B/(I*Betta), {c1, c2,
c3, B}];
k2 = k /. {C[1] -> roots[[1, 1]], C[2] -> roots[[1, 2]],
C[3] -> roots[[1, 3]], B -> roots[[1, 4]]}
At the end I would like to have a function which I can plot with standard methods
C[k]
?Solve[0 == C[1] +C[2] Cosh[I/2*(I*Betta)^0.5] + ... && (* equations *), {C[1], C[2], C[3], B}]
$\endgroup$Solve[0==C[1]+C[2] ...
. Maybe I wasn't clear, but I think your idea doesnt make sense. The first part of your Solve would be one of the equations that give the solution. The system of equations that give c1,c2,c3,B is exactly the one inside my Solve expressione. I want to substitute these solutions (which are given in vectorial form) INSIDE the function k(z) which comes from the DSolve and has got C[1],C[2],C[3],B.. inside, which I dont know how to replace with my c1,c2,c3,B. $\endgroup$c1
, intoC[1]
, since you can doDSolve[(* stuff *)] /. Solve[(* stuff *)]
. That's why I'm saying that you can useC[1]
, etc. instead ofc1
, etc. inSolve[]
. $\endgroup$