2
$\begingroup$

I can't get Mathematica to solve the simple differential equation system below. Could anyone please help?[

DSolveValue[{x'[t] == 2 x[t] + E^t y[t] - E^t, 
  y'[t] == 4 E^-t x[t] + y[t]}, {x[t], y[t]}, t]

The solution should be sums of exponentials (for both x(t) and y(t)).

$\endgroup$
  • $\begingroup$ Please post your code as text, not pictures. $\endgroup$ – MarcoB Aug 21 '17 at 3:08
  • $\begingroup$ There are certain limitations to using DSolve, not every differential equation gets solved analytically using it. There are 2 things which you can do 1. Take a variable transformation such tat the equations can be written in a simpler form 2. If you have some initial conditions for the problem, try solving it numerically. $\endgroup$ – Bruce Lee Aug 21 '17 at 6:20
1
$\begingroup$

As proposed by @ Bruce Lee you may try the following. Let us represent x(t)=u(t)*v(t) and y(t)=g(t)*w(t) and substitute them into the equations:

eq1A=x'[t] == 2 x[t] + E^t y[t] - E^t /. x :> (u[#]*v[#] &) /. 
 y :> (g[#]*w[#] &)
eq2A=y'[t] == 4 E^-t x[t] + y[t] /. x :> (u[#]*v[#] &) /. 
 y :> (g[#]*w[#] &)

(*  v[t] Derivative[1][u][t] + u[t] Derivative[1][v][t] == -E^t + 
  2 u[t] v[t] + E^t g[t] w[t] 
w[t] Derivative[1][g][t] + g[t] Derivative[1][w][t] == 
 4 E^-t u[t] v[t] + g[t] w[t]    *)

Let us now choose v(t) and w(t) such that the terms 2 u[t] v[t] in the first equation and g[t] w[t]in the second one vanish:

DSolve[ Derivative[1][v][t] == 2 v[t], v[t], t][[1, 1]] /. C[1] -> 1
DSolve[ Derivative[1][w][t] == w[t], w[t], t][[1, 1]] /. C[1] -> 1

(*  v[t] -> E^(2 t)  
    w[t] -> E^t       *)

and substitute this into the equations obtained during the previous step:

eq1B = Map[Divide[#, E^t] &, 
  w[t] Derivative[1][g][t] + g[t] Derivative[1][w][t] == 
      4 E^-t u[t] v[t] + g[t] w[t] /. w :> (E^# &) /. 
    v -> (E^(2 #) &) // Simplify]
eq2B = Map[Divide[#, E^t] &, 
  v[t] Derivative[1][u][t] + u[t] Derivative[1][v][t] == -E^t + 
       2 u[t] v[t] + E^t g[t] w[t] /. w :> (E^# &) /. 
    v -> (E^(2 #) &) // Simplify]

(*  4 u[t] == Derivative[1][g][t]
     E^t g[t] == 1 + E^t Derivative[1][u][t]   *)

Note that I in addition cancelled the common term Exp[t]. Now one can calculate the derivative of the equation 1B and substitute it into 2B:

eq1C = Solve[Map[D[#, t] &, eq1B], u'[t]][[1, 1]]

(*  Derivative[1][u][t] -> (g^\[Prime]\[Prime])[t]/4  *)
  (*  Derivative[1][u][t] -> (g^\[Prime]\[Prime])[t]/4  *)

Let us now substitute the result into eq2B:

 eq2C = eq2B /. eq1C

(*  E^t g[t] == 1 + 1/4 E^t (g^\[Prime]\[Prime])[t]  *)

The latter equation can be solved using DSolve :

DSolve[eq2C, g[t], t]

(*   {{g[t] -> (4 E^-t)/3 + E^(2 t) C[1] + E^(-2 t) C[2]}}   *)

Now one can go back and find the initial variables x and y. This is, however, already trivial.

Have fun!

$\endgroup$
1
$\begingroup$

The solution can be obtained without difficulty by observing that the substitution x[t] -> z[t] E^t immediately eliminates all exponentials from the two ODEs.

Unevaluated[{D[x[t], t] == 2 x[t] + E^t y[t] - E^t, 
    D[y[t], t] == 4 E^-t x[t] + y[t]}] /. x[t] -> z[t] E^t;

whereupon DSolve returns

Flatten@DSolve[%, {z[t], y[t]}, t] // Simplify

(* {y[t] -> 1/6 (8 + 3 E^-t (C[1] - 2 C[2]) + 3 E^(3 t) (C[1] + 2 C[2])),
    z[t] -> 1/12 E^-t (-4 E^t - 3 C[1] + 6 C[2] + 3 E^(4 t) (C[1] + 2 C[2]))} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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