# Solving differential equations with Wolfram Mathematica

So i saw this differential equations in my textbook

$\frac{{{d^4}\omega }}{{d{x^4}}} + 4{\lambda ^4}\omega = 0$

and i figured why not solve it with majestic Wolfram Mathematica, so i write this code:

DSolve[ω''''[x] + 4*λ^4*ω[x] == 0, ω[x],x]


the result:

$\omega (x)\to c_1 e^{(-1)^{3/4} \sqrt{2} \lambda x}+c_2 e^{-\sqrt[4]{-1} \sqrt{2} \lambda x}+c_3 e^{-(-1)^{3/4} \sqrt{2} \lambda x}+c_4 e^{\sqrt[4]{-1} \sqrt{2} \lambda x}$

which is a lot different from what my textbook presented:

$\omega (x) = {e^{\lambda x}}({c_1}\cos \lambda x + {c_2}\sin \lambda x) + {e^{ - \lambda x}}({c_3}\cos \lambda x + {c_4}\sin \lambda x)$

where did i go wrong, how can i get the same answer?

unpacking the $\sqrt[4]{{ - 1}}$ term as follow:

for $\sqrt[4]{-1}=\frac{1+i}{\sqrt{2}}$ and $(-1)^{3/4}=\frac{i-1}{\sqrt{2}}$

$\begin{array}{c} \omega (x) = {c_1}{e^{( - 1 + i)\lambda x}} + {c_2}{e^{( - 1 - i)\lambda x}} + {c_3}{e^{(1 - i)\lambda x}} + {c_4}{e^{(1 + i)\lambda x}}\\ = {e^{ - \lambda x}}({c_1}{e^{i\lambda x}} + {c_2}{e^{ - i\lambda x}}) + {e^{\lambda x}}({c_3}{e^{ - i\lambda x}} + {c_4}{e^{i\lambda x}}) \end{array}$

Acorrding to Eulers formula： ${e^{ix}} = \cos x + i\sin x$

$\begin{array}{c} \omega (x) = {e^{ - \lambda x}}({c_1}(\cos \lambda x + i\sin \lambda x) + {c_2}(\cos \lambda x - i\sin \lambda x)) + {e^{\lambda x}}({c_3}(\cos \lambda x - i\sin \lambda x) + {c_4}(\cos \lambda x + i\sin \lambda x))\\ = {e^{ - \lambda x}}(({c_1} + {c_2})\cos \lambda x + ({c_1} - {c_2})i\sin \lambda x) + {e^{\lambda x}}(({c_3} + {c_4})\cos \lambda x + ({c_4} - {c_3})i\sin \lambda x) \end{array}$

Simplify:

$\omega (x) = {e^{ - \lambda x}}({C_1}\cos \lambda x + {C_2}i\sin \lambda x) + {e^{\lambda x}}({C_3}\cos \lambda x + {C_4}i\sin \lambda x)$

There is an extra i comparing to the textbook.

• Just because two mathematical expressions appear different, this does not mean they do not represent the same thing. – Nasser Mar 25 '15 at 8:06
• There is an extra i comparing to the textbook it is normal to rename the whole thing to a constant. i.e. $(c_1-c_2)i$ is renamed to new constant, say $C[1]$. So the $i$ goes with the constant and is not left out. This is standard way of reformulating solutions to ode's so the solution is written in terms of trig functions. – Nasser Mar 25 '15 at 8:50

Since you do not have initial conditions, the constants generated by Mathematica is solved for by comparing terms with $\sin$ and $\cos$ to make them match the book result. Then 4 equations solved to find the mapping

Clear[w, x, lam]
sol = w[x] /. First@DSolve[w''''[x] + 4*lam^4*w[x] == 0, w[x], x];
sol = ComplexExpand@sol


Comparing the above to book solution

book = Exp[lam x] (c[1] Cos[lam x] + c[2] Sin[lam x]) +
Exp[-lam x] (c[3] Cos[lam x] + c[4] Sin[lam x])


4 equations are solved

eq1 = C[1] + C[2] == c[3];
eq2 = C[1] - C[2] == -I c[4];
eq3 = C[3] + C[4] == c[1];
eq4 = C[4] - C[3] == -c[2] I;
map = Solve[{eq1, eq2, eq3, eq4}, {C[1], C[2], C[3], C[4]}]


So the above is the mapping between Mathematica solution and book solution. Verifying

Simplify[book - (sol /. map)]


• Oh, i get it, the imaginary number is STILL a number. – user226247 Mar 25 '15 at 8:53
• ComplexExpand@Re@sol is perhaps a shorter way to the book solution. Of course, then someone new to complex numbers might want to know why the real (and imaginary) part of a solution to a diff. eqn. (with real coefficients) also satisfies the diff. eqn. – Michael E2 Mar 25 '15 at 10:25

They are the same but they are written differently. Note that $\omega(0)= c_1+c_2+c_3+c_4$ in Mathematica but $\omega(0)= c_1+c_3$ in the book. So these are different coeffcients. So use the following:

ComplexExpand[DSolveValue[ω''''[x] + 4*λ^4*ω[x] == 0, ω[x], x]]


to get something similar to what you want. But you still need to redefine the coefficients. Also, note that $(-1)^{0.25}\sqrt{2}=1 + i$ and $(-1)^{0.75}\sqrt{2}=-1 + i$ !

• but there are no imaginary number in the textbook, does it mean that the answer is wrong? – user226247 Mar 25 '15 at 8:43