Message Boards Message Boards

GROUPS:

[✓] Solve a system of DEs with initial conditions?

Posted 4 months ago
531 Views
|
2 Replies
|
2 Total Likes
|

So I need to solve a system of 3 DEs, I have 3 unknown functions and 4 initial conditions which is enough to find particular solutions.

I have tried doing it myself and I came up with a solution: My solution

Then I tried using the DSolve[] function but it keeps returning an error. Mathematica error

What's the problem? How do I do it?

2 Replies
In[1]:= Needs["VariationalMethods`"]
L = z'[x]^2 - 2*(x*Cos[x] + Sin[x])*z'[x] - y[x]^2 + 
   l[x]*(z[x] - y'[x] - x*Sin[x]);
eq1 = EulerEquations[L, y[x], x];
eq2 = EulerEquations[L, z[x], x];
eq3 = {-x*Sin[x] + z[x] - y'[x] == 0, y[0] == 1, y[Pi/2] == 0, 
   z[0] == 0, z[Pi/2] == -1};

In[6]:= s = DSolve[{eq1, eq2, eq3}, {l, y, z}, x]

Out[6]= {{l -> 
   Function[{x}, -(1/8) E^(-(\[Pi]/2) - 
      x) (-2 E^(\[Pi]/2) \[Pi] + 2 E^\[Pi] \[Pi] + 2 E^(2 x) \[Pi] + 
       2 E^(\[Pi]/2 + 2 x) \[Pi] - 4 E^(\[Pi]/2 + x) Cos[x] + 
       2 E^x \[Pi] Cos[x] + 2 E^(\[Pi] + x) \[Pi] Cos[x] + 
       4 E^(\[Pi]/2 + x) Cos[x] Cos[2 x] - 
       16 E^(\[Pi]/2 + x) Sin[x] - 2 E^x \[Pi] Sin[x] - 
       4 E^(\[Pi]/2 + x) \[Pi] Sin[x] + 
       2 E^(\[Pi] + x) \[Pi] Sin[x] - 2 E^(\[Pi]/2) Cos[x] Sin[x] + 
       2 E^(\[Pi]/2 + 2 x) Cos[x] Sin[x] + 
       4 E^(\[Pi]/2 + x) Cos[x] Sin[x]^2 + E^(\[Pi]/2) Sin[2 x] - 
       E^(\[Pi]/2 + 2 x) Sin[2 x] + 
       2 E^(\[Pi]/2 + x) Sin[x] Sin[2 x])], 
  y -> Function[{x}, -(1/16) E^(-(\[Pi]/2) - 
      x) (2 E^(\[Pi]/2) \[Pi] - 2 E^\[Pi] \[Pi] + 2 E^(2 x) \[Pi] + 
       2 E^(\[Pi]/2 + 2 x) \[Pi] - 16 E^(\[Pi]/2 + x) Cos[x] - 
       2 E^x \[Pi] Cos[x] - 4 E^(\[Pi]/2 + x) \[Pi] Cos[x] + 
       2 E^(\[Pi] + x) \[Pi] Cos[x] - 4 E^(\[Pi]/2 + x) Sin[x] - 
       2 E^x \[Pi] Sin[x] - 2 E^(\[Pi] + x) \[Pi] Sin[x] + 
       2 E^(\[Pi]/2) Cos[x] Sin[x] + 
       2 E^(\[Pi]/2 + 2 x) Cos[x] Sin[x] + 
       4 E^(\[Pi]/2 + x) Cos[x]^2 Sin[x] - 
       4 E^(\[Pi]/2 + x) Cos[2 x] Sin[x] - E^(\[Pi]/2) Sin[2 x] - 
       E^(\[Pi]/2 + 2 x) Sin[2 x] + 
       2 E^(\[Pi]/2 + x) Cos[x] Sin[2 x])], 
  z -> Function[{x}, -(1/16) E^(-(\[Pi]/2) - 
      x) (-2 E^(\[Pi]/2) \[Pi] + 2 E^\[Pi] \[Pi] + 2 E^(2 x) \[Pi] + 
       2 E^(\[Pi]/2 + 2 x) \[Pi] + 4 E^(\[Pi]/2 + x) Cos[x] - 
       2 E^x \[Pi] Cos[x] - 2 E^(\[Pi] + x) \[Pi] Cos[x] - 
       4 E^(\[Pi]/2 + x) Cos[x] Cos[2 x] + 
       16 E^(\[Pi]/2 + x) Sin[x] + 2 E^x \[Pi] Sin[x] + 
       4 E^(\[Pi]/2 + x) \[Pi] Sin[x] - 
       2 E^(\[Pi] + x) \[Pi] Sin[x] - 16 E^(\[Pi]/2 + x) x Sin[x] - 
       2 E^(\[Pi]/2) Cos[x] Sin[x] + 
       2 E^(\[Pi]/2 + 2 x) Cos[x] Sin[x] - 
       4 E^(\[Pi]/2 + x) Cos[x] Sin[x]^2 + E^(\[Pi]/2) Sin[2 x] - 
       E^(\[Pi]/2 + 2 x) Sin[2 x] - 
       2 E^(\[Pi]/2 + x) Sin[x] Sin[2 x])]}}

Thanks a lot, Alexander!

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