Message Boards Message Boards

0
|
5293 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

DSolve on Vector Equations?

Posted 11 years ago

Hi,
I'm playing with DSolve and would like to solve a vector equation with boundary conditions. Say I have a simple equation like this:

deq = m r''[t] == m a

Now I want r and a to be vectors and solve deg for some boundary conditions r[0]={0,1} and r'[0]={1,1}. This should be easy but I don't know how to tell Matematica (v10). I tried this, but it's not working:

DSolve[{deq, r[0] == {0, 1}, r'[0] == {1, 1}}, {r[t]}, {t}]
DSolve::bvnul: For some branches of the general solution, the given boundary conditions lead to an empty solution. >>

So, whats the right way to do it?

Flo

Edit: 'Manually' writing down the two equations works, but it's not exactly elegant:

In[1]:= deq = {m rx''[t] == m ax, m ry''[t] == m ay};
        DSolve[{deq, rx[0] == 0, ry[0] == h, rx'[0] == vx, ry'[0] == vy}, {rx[t], ry[t]}, {t}]
Out[2]= {{rx[t] -> 1/2 (ax t^2 + 2 t vx), ry[t] -> 1/2 (2 h + ay t^2 + 2 t vy)}}
POSTED BY: Florian Rist
2 Replies

Hi,

You can define a function that generates equations and initial conditions for DSolve[] more or less routinely. Here is an example:

equations = Join[
        Thread[D[Through[#1[t]],{t, 2}] == #2] ,
        Thread[Join[D[Through[#1[t]],t] /. t -> 0 ,Through[#1[0]]] == #3]
    ] & ;

Now your original system can be solved as follows:

lhs = {rx, ry};
rhs = {ax  , ay};
ini = {0, h, vx, vy} ;
DSolve[equations[lhs, rhs, ini], Through[lhs[t]], t] 

For 3D vectors:

lhs = {rx, ry, rz};
rhs = {ax, ay, az};
ini = {0, h, 0, vx, vy, vz} ;
DSolve[equations[lhs, rhs, ini], Through[lhs[t]], t] 

Or you can generate all DSolve[] input with one function:

system = Sequence @@ {equations[#1, #2, #3], Through[#1[t]], t} & ;
DSolve[system[lhs, rhs, ini]] 
POSTED BY: Ivan Morozov
Posted 6 years ago

Is there a way to keep input variables as vectors, instead of specifying components?

POSTED BY: ion sme
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract