1
$\begingroup$

I am solving the following equation using Dsolve command in Mathematica:

DSolve[a1*y''[x] + y''''[x] == 0, y[x], x]

The general solution of these equations are of the form:

y = c1+c2*x+c3*Cos[Sqrt[a1]*x]+c4*Sin[Sqrt[a1]*x]

But, Mathematica gives me the following solution:

C[3] + x C[4] + (-((C[1] Cos[x Sqrt[a1]])) - (C[2] Sin[x Sqrt[a1]]))/a1

Although, both of the solutions are equivalent since you can always you can change your constants, however, I want the general solution (y= c1+c2*x+c3*Cos[Sqrt[a1]*x]+c4*Sin[Sqrt[a1]*x]) as the output from Mathematica. Can you please suggest what additional conditions I need to impose so that Mathematica gives result exactly as general solution?

Thank you very much for your help!

$\endgroup$
  • $\begingroup$ DSolve[a1*y''[x] + y''''[x] == 0, y[x], x] $\endgroup$ – user7056953 Feb 5 at 10:26
  • $\begingroup$ Apply Expand to the output of NDSolve. Apart from naming conventions for the constants, the result is very close to the desired form. You can replace the constants with ReplaceAll. $\endgroup$ – Henrik Schumacher Feb 5 at 10:35
  • $\begingroup$ You mean DSolve and not NDSolve ? $\endgroup$ – user7056953 Feb 5 at 10:38
  • $\begingroup$ Oops. Yes. I meant DSolve. $\endgroup$ – Henrik Schumacher Feb 5 at 10:46
2
$\begingroup$

You could use boundary conditions to fix the names of your parameters:

DSolve[{a1*y''[x] + y''''[x] == 0,
  y[0] == c1 + c3,
  y'[0] == c2 + Sqrt[a1] c4,
  y''[0] == -a1 c3,
  y'''[0] == -a1^(3/2) c4},
  y[x], x] // Expand
(* {{y[x] -> c1 + c2 x + c3 Cos[Sqrt[a1] x] + c4 Sin[Sqrt[a1] x]}} *)
$\endgroup$
1
$\begingroup$

Just combine constants.

DSolve[a1*y''[x] + y''''[x] == 0, y[x], x] // Flatten // Simplify

(*{y[x] -> (a1 C[4] x - C[2] Sin[Sqrt[a1] x] - C[1] Cos[Sqrt[a1] x] + a1 C[3])/a1}*)

y[x_] = y[x] /. % /. {C[1] -> -a1 C[1], C[2] -> -a1 C[2]} // Simplify

(*C[2] Sin[Sqrt[a1] x] + C[1] Cos[Sqrt[a1] x] + C[4] x + C[3]*)

Works because a1 * an arbitrary constant is still an arbitrary constant.

$\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.