How to get companion system in Mupad
2 views (last 30 days)
Show older comments
Hi,
I would like ask how to get the companion system of ODE in Mupad. I have system of 2 ODE's first is 2'nd order second is 1'st order.
They look like this (mupad syntax)
Lt :=[ L*diff(i_1(t),t$2)+(i_1(t)-i_2(t))/C, R*diff(i_1(t),t$1)+(i_2(t)-i_1(t))/C] ;
I know how to get the companion systems of one equation, using this function. ode::companionSystem(Equa, Var) ; If I apply this function to my system ODE's it does not function.
Could somebody give me any advice? Thanks Jan
0 Comments
Answers (3)
Andrew Newell
on 17 Feb 2011
You could eliminate the variable i2 by solving for it in the second equation and substituting in the first. Then you have a second order ODE for i1 alone, and you can find the companion system for that.
0 Comments
Christopher Creutzig
on 18 Feb 2011
I am not sure what the companion system of a system of differential equations would be, the definition does not, in my opinion, canonically generalize. However, if what you are looking for is what I would call a phase space representation (which your answer seems to suggest), you may be interested in numeric::ode2vectorfield, as in:
Lt :=[i_1'(t) = L*diff(i_1(t),t$2)+(i_1(t)-i_2(t))/C,
i_2'(t) = R*diff(i_1(t),t$1)+(i_2(t)-i_1(t))/C]:
fields := [i_1(t), i_1'(t), i_2(t)]:
fn := numeric::ode2vectorfield(
Lt . map(fields, f -> (f | t=0) = dummy), fields)[1]:
zip(map(map(fields, diff, t), rewrite, D), fn(t, i), `=`)
[i_1'(t) = i[2],
i_1''(t) = (C*i[2] - 1.0*i[1] + i[3])/(C*L),
i_2'(t) = (i[3] - 1.0*i[1] + C*R*i[2])/C]
This has some drawbacks and may not be the final solution for you:
- numeric::ode2vectorfield will call float on its input, so you may need to work with rationalize if you want to preserve constants like ?, and use numeric::rationalize on the output, too.
- It does not create the list fields for you, but will complain if that list does not work for the input you have.
- numeric::ode2vectorfield will not do symbolic differentiation etc. in its computation, but instead will simply refuse to work on inputs that are not quasi-linear.
- I may have completely misinterpreted your question and this may not at all be what you are looking for in the first place. Then again, it may be a step that can become useful in a larger program. :-)
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!