need to equate MATLAB and MATHEMATICA solutions

35 Views Asked by At

Am trying to utilize MATLAB and MATHEMATICA to solve $$y''(x)+ω^2y(x)=0.$$

Mathematica gives the expected answer of $C_1\cos(xω) + C_2\sin(xω)$ while Matlab gives $C_1e^{xωi}+C_2e^{−xωi}$.

I'm guessing (!) that Euler's theorem might provide a way of equating these two answers, but i cannot find it. Help requested.

1

There are 1 best solutions below

2
On BEST ANSWER

The Mathematica's solution $$ C_1\cos(xω) + C_2\sin(xω) $$ is a real solution and that is what we really deal with in real life problems.

The Matlab's solution $$ C_1e^{xωi}+C_2e^{−xωi}$$ is complex valued solution.

We may derive the real valued solution from the Matlab's solution by considering the real parts and the imaginary parts of the complex valued solution.

They are solutions because they are indeed a linear combination of the complex valued solutions.

Thus the Mathmica's solution is a linear combination of Matlab's solution.

Note that we are really looking for real valued solutions in real life problems so the Mathematica wins in this case.