Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I don't get any answer when I evaluate the following expression:

DSolve[{x'[t] == -0.5*y[t] + 1 + 3*(e^(-2*t)), 
        y'[t] == 2*x[t] - y[t] - 4 - 4* (e^(-t)), 
        y[0] == 0, x[0] == 0}, {x[t], y[t]} , t]

Did I go wrong somewhere?

I tried solving this equation set with Laplace as well, but I didn't get any answer from that either.

share|improve this question
2  
Is it e, or E ? –  belisarius Oct 17 '12 at 17:28
add comment

2 Answers 2

up vote 6 down vote accepted

Try replacing the .5by 1/2 and the e by E. Also, the asterisks aren't needed in Mathematica.

s = DSolve[
 {x'[t] == -1/2 y[t] + 1 + 3 E^(-2 t),
  y'[t] == 2 x[t] - y[t] - 4 - 4 E^(-t),
  y[0]  == 0, 
  x[0]  == 0}, {x[t], y[t]}, t]

ParametricPlot[{x[t], y[t]} /. s, {t, 0, 10}, AxesOrigin -> {0, 0}]  

Mathematica graphics

share|improve this answer
    
and //FullSimplify ;) –  Vitaliy Kaurov Oct 17 '12 at 17:32
    
@VitaliyKaurov Tried that, but the result isn't compact enough to look nice here. So I kept it like that. –  belisarius Oct 17 '12 at 17:34
1  
That was more a tip for @DSaad than an edit suggestion :) –  Vitaliy Kaurov Oct 17 '12 at 17:36
add comment

Two problems here are e instead of E and 0.5 instead of 1/2. For a larger system it would be more reasonable to use Rationalize instead of substituting all numbers by hand. To get a wider class of solutions we could define a function being a solution of the system of differential equations, where the initial values are parametrized by x0:

ds[x0_] = Simplify @ DSolve[ Rationalize @ {x'[t] == -0.5*y[t] + 1 + 3*(E^(-2*t)),
                                            y'[t] == 2*x[t] - y[t] - 4 - 4*(E^(-t)), 
                                            y[0] == 0, 
                                            x[0] == x0},     {x[t], y[t]}, t]

enter image description here

originally x0 == 0, i.e.

ds[0]

enter image description here

To plot the wider class of solutions we could use ParametricPlot as in belisarius answer with Show emphasizing ds[0] solution as a red thick curve :

Show[
      ParametricPlot[{x[t], y[t]} /. Table[ds[x0], {x0, -2, 4, 0.2}],
                                                   {t, -1, 10}, Evaluated -> True], 
      ParametricPlot[{x[t], y[t]} /. ds[0], {t, -1, 10}, 
                                             PlotStyle -> {Darker@Red, Thickness[0.007]}],
      AxesOrigin -> {0, 0}, PlotRange -> {{-1, 6}, {-4, 5}}]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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