1
$\begingroup$

I know how to use the LaplaceTransform function but am struggling to do this with a system with two ODEs.

This is my question:

Use Mathematica and the Laplace transform method to solve the system: $$\begin{cases}f^\prime&=3f+5g-\sin(x)\\g^\prime&=2f-g+\cos(x)\end{cases}$$ with initial conditions $f(0)=0$ and $g(0)=1$

$\endgroup$
  • $\begingroup$ How do you try solving the system with LaplaceTransform? Have you checked the Applications section of document of LaplaceTransform? $\endgroup$ – xzczd Apr 2 at 6:36
  • $\begingroup$ The matrix {{3, 5}, {2, -1}} is diagonalizable, so you can decouple the system first and solve each equation via Laplace transform. $\endgroup$ – Henrik Schumacher Apr 2 at 6:43
7
$\begingroup$
odes = {f'[x] == 3 f[x] + 5 g[x] - Sin[x],  g'[x] == 2 f[x] - g[x] + Cos[x]};
ics = {f[0] == 0, g[0] == 1};

LaplaceTransform[odes, x, s] /. Rule @@@ ics /. HoldPattern@LaplaceTransform[a_, __] :> a

enter image description here

sol = {f[x], g[x]} /. First@Solve[%, {f[x], g[x]}]

enter image description here

InverseLaplaceTransform[sol, s, x] // FullSimplify

enter image description here

$\endgroup$
  • $\begingroup$ Im assuming this is correct, but shouldn't the answer be one expression only? Also the seocnd part of the question says to solve this problem with Dsolve and show it the same, how would we do this? $\endgroup$ – greg Apr 2 at 9:38
  • $\begingroup$ @greg You have one solution each for f [x] and g [x]. The solution is given as a list {f [x], g [x]}! The DSolve solution is also very simple: DSolve [{odes, ics}, {f [x], g [x]}, x] // FullSimplify. It is the same solution. Look in the mathematica documentation. Here you learn a lot! The next time you are able to do this without help from others. $\endgroup$ – rmw Apr 2 at 12:46

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.