# [✓] Solve symbolic system of differential and algebric equations?

Posted 11 months ago
1065 Views
|
7 Replies
|
1 Total Likes
|
 Hello everyone, I tried to solve a symbolic system of differential and algebric equations between (0,x) with the following code: DSolve[{(Qd Cd)'[x] == kd (Ci[x] - Cd[x]), (Qd)'[x] == ko (Cd[x] - Ci[x]), Qa (Ca)'[x] == ka Ca[x], ka Ca[x] == kd (Ci[x] - Cd[x])}, {Qd, Cd, Ca}, x] where Qa, ko, ka, kd are positive constants. The code does not work. I expect the solution:Thank you very much for your time. Attachments:
7 Replies
Sort By:
Posted 11 months ago
 Gennaro,you have multiple issues going on here. You have 4 things that vary in x but only include 3 in the list of variables. I do not understand what this means (Qd Cd)'[x]. It cannot be correct. I would not put parens around (Ca)'[x] although syntactically its ok.I changed your equations and this solves but I am not sure what your original equations should be: DSolve[{Derivative[1][Cd][x] == kd (-Cd[x] + Ci[x]), Derivative[1][Qd][x] == ko (Cd[x] - Ci[x]), Qa Derivative[1][Ca][x] == ka Ca[x], ka Ca[x] == kd (-Cd[x] + Ci[x])}, {Qd[x], Cd[x], Ca[x], Ci[x]}, x] I hope this helps.Regards,Neil
Posted 11 months ago
 Hello @Neil Singer , the term (Qd Cd)'[x] means d(Qc Cd) /dx. I tried to correct the code, but maybe my syntax is wrong: DSolve[{Derivative[1][Qd Cd][x] == kd (-Cd[x] + Ci[x]), Derivative[1][Qd][x] == ko (Cd[x] - Ci[x]), Qa Derivative[1][Ca][x] == ka Ca[x], ka Ca[x] == kd (-Cd[x] + Ci[x])}, {Qd[x], Cd[x], Ca[x], Ci[x]}, x] and with: DSolve[{D[Qd[x] Cd[x], x] == kd (-Cd[x] + Ci[x]), Derivative[1][Qd][x] == ko (Cd[x] - Ci[x]), Qa Derivative[1][Ca][x] == ka Ca[x], ka Ca[x] == kd (-Cd[x] + Ci[x])}, {Qd[x], Cd[x], Ca[x], Ci[x]}, x] Thank you so much.
Posted 11 months ago
 Your last equation is algebraic, not differential. You can solve it for Cd[x] and replace in the other equations: eq0 = {D[Qd[x]*Cd[x], x] == kd (-Cd[x] + Ci[x]), Qd'[x] == ko (Cd[x] - Ci[x]), Qa Ca'[x] == ka Ca[x], ka Ca[x] == kd (-Cd[x] + Ci[x])}; eq1 = Most[eq0] /. Solve[Last[eq0], Cd[x]][[1]]; eq3 = Solve[eq1, D[{Qd[x], Ca[x], Cd[x]}, x]][[1]] /. Rule -> Equal; DSolve[eq3, {Qd[x], Ca[x], Cd[x]}, x] 
Posted 11 months ago
 Hello @Gianluca Gorni , why in the solution occur an integral? I attach the step-by-step solution. Cd[x] -> C[3] + Integrate[(( E^((ka K[1])/Qa) ka C[1] (-kd^2 + E^((ka K[1])/Qa) ka ko C[1] - kd ko Ci[K[1]]))/( kd (E^((ka K[1])/Qa) ko Qa C[1] - kd C[2]))) 
Posted 11 months ago
 The last syntax seems Ok. My code posted with Derivative[1][Ca][x] but you can use the prime notation (Ca'[x]). I suppose that WMA does not know how to solve this DAE. You may want to verify your equation source or try to dive in and see why by examining the equations or manipulating them. You can also verify them numerically by doing an NDSolve and compare the results to what you know about your problem.
Posted 11 months ago
 @Neil Singer see the attachment please. There is the step-by-step solution.
Posted 11 months ago
 Very good, Gianluca -- As I said, Gennaro, they are DAE's and needed manipulation... :)
Community posts can be styled and formatted using the Markdown syntax.