how to solve this differential equation system symbolically?
2 views (last 30 days)
John D'Errico on 1 May 2022
Edited: John D'Errico on 1 May 2022
This seems like a homework problem. But Walter has already given an answer, that I think is not helpful, since dsolve will fail when applied directly. And since the problem is insufficiently defined to be a good homework problem, I might conjecture it is not in fact homework.
syms y(t) x(t) f(t)
dy = diff(y);
E1 = x + dy == f;
E2 = diff(x) + y == diff(f);
First, differentiate E1, subtracting E2 from that.
E3 = simplify(diff(E1) - E2)
As you can see, x(t) and f(t) have been completely eliminated from the result. However, now we can solve for y(t).
y(t) = dsolve(E3,y(0) == 0, dy(0) == 1)
In fact, if you think about it, note that this is a well known function : the hyperbolic sine function.
y = rewrite(y,'sinh')
Now that we have y(t), return to equations E1 and E2.
E1 = subs(E1)
From this we see that x(t) and f(t) are simply related, differening only by that cosh(t) term.
E2 = subs(E2)
The problem is, at this point you are now stuck. Lacking f(t) or y(t), you cannot find the other. What is worse, We see that now E1 and E2 are actually the same pieces of information, since we can derive E2 from E1. That is, just differentiate both sides of E1, and look to see what you get.
SURPRISE! Differentiating E1 yields E2.
The point is, you lack sufficient information to solve the problem, even though you can solve for y(t). So perhaps that is the point of this assignment, IF it is one. Anyway, since the problem already had an answer, I might as well have written this.
More Answers (1)
Walter Roberson on 1 May 2022
Create the symbols and the two equations. dsolve() the pair of equations without boundary conditions, getting out a struct with a definition for x and y. Take the y and substitute t = 0 to get y(0) and equate that to the known value. Take the y and differentiate and substitute t = 0 to get y'(0) and equate that to the known value. You now have a pair of simultaneous equations relating the constants of the differential equations.