2
$\begingroup$

I have a set of differential equations (or DAEs): $\begin{cases} 5x_{2} + 3x_{4} + 3x_{5} = \frac{dx_{1}}{dt}\\ 5x_{1} + 5x_{2} + 5x_{3} + 3x_{4} + x_{5}= 0\\ 3x_{2} + 3x_{4} + 10x_{5} = \frac{dx_{3}}{dt}\\x_{1} + 3_{2} + 2x_{3} + 3x_{4} + 10x_{5} = 0\\ x_{1} + 2x_{2} + 3x_{3} + 4x_{4} + 5x_{5} = \frac{dx_{5}}{dt}\end{cases}$

I hope to impose the normalization condition that $|x_{1}|^2+|x_{2}|^2+|x_{4}|^2$=1 for all time. This is, however, not an initial condition.

Can someone help me? Thank you very much.

When I try to add the normalization condition as part of the DAEs equations, the error is:

Solve::inex: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help. >> DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. >>

(Note: The above set of differential equations is just arbitrary, may not be consistent or solvable.)

$\endgroup$
3
  • 1
    $\begingroup$ Please post Mathematica code, not TeX. Thanks $\endgroup$ Commented Feb 18, 2015 at 17:45
  • $\begingroup$ Also, please do not use subscripts here. They add needless complexity. Instead, use x1 etc. Thanks. $\endgroup$
    – bbgodfrey
    Commented Feb 18, 2015 at 17:52
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Commented Feb 18, 2015 at 18:16

1 Answer 1

3
$\begingroup$
a = {{0, 0, 5, 3, 3}, {5, 5, 5, 3, 1}, {0, 3, 0, 3, 10}, {1, 3, 2, 3, 10}, {1, 2, 3, 4, 5}};
vars = {x1@t, x2@t, x3@t, x4@t, x5@t};
normeq = x1[t]^2 + x2[t]^2 + x4[t]^2 == 1; 
eq = Thread[a.vars == {x1'[t], 0, x3'[t], 0, x5'[t]}];
sol = DSolve[eq, vars, t];
cs = Solve[normeq /. sol, {C[1], C[2], C[3]}];
k = vars /. sol /. cs[[1]] /. C[_] :> 0 // N;
Plot[{k, Norm[{k[[1, 1]], k[[1, 2]], k[[1, 4]]}]}, {t, 0, 2}]

Mathematica graphics

Where you can see the normeq is satisfied as requested

$\endgroup$
6
  • $\begingroup$ Thank you very much. Do C[1],C[2],C[3] mean the constants in the solution in differential equations? After cs = Solve[normeq /. sol, {C[1], C[2], C[3]}], I get only the solution of C[3] in terms of C[1] and C[2]. Can you tell me what k means? Thanks $\endgroup$
    – Ka Wa Yip
    Commented Feb 19, 2015 at 0:53
  • 1
    $\begingroup$ @kwyip Yep. The Cs are those constants. k means nothing, it's just a holding var for the ODE results $\endgroup$ Commented Feb 19, 2015 at 2:42
  • $\begingroup$ Does the line "k = vars /. sol /. cs[[1]] /. C[_] :> 0 // N;" mean setting C[1], C[2] and C[3] to zero? and does the line "Plot[{k, Norm[{k[[1, 1]], k[[1, 2]], k[[1, 4]]}]}, {t, 0, 2}]" mean plotting k, x1, x2, x3, x4 and x5 versus time? Thank you very much. $\endgroup$
    – Ka Wa Yip
    Commented Feb 24, 2015 at 21:03
  • $\begingroup$ I wonder how to assign values to the constants C[1],C[2] and C[3]. I try with C[1] = 1 but it fails (with the reason (I get the warnings like Set::write: Tag C in C[1] is Protected. >> ) $\endgroup$
    – Ka Wa Yip
    Commented Feb 25, 2015 at 4:42
  • 1
    $\begingroup$ @kwyip You still need to learn the very basics. Do this yourExpression /. C[1]->0 and then search the docs for ReplaceAll[] $\endgroup$ Commented Feb 25, 2015 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.