1
$\begingroup$

For example,

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

gives

{{y[x] -> C[1] Cos[x] + C[2] Sin[x]}}

as the result.

Can we add any option(s) to make us get

{{y[x] -> C[1] E^(I x) + C[2] E^(-I x)}}

instead?

Maybe TrigToExp would be suggested, but it will lead to extra 1/2 factor in the solutions.

Update1: Admittedly, combination of TrigToExp and GeneratedParameters -> (2 C[#] &) can realize the expected output. However, I actually want a pure option of DSolve that can do the job.

So, there is none of such an option? And does this state of affairs mean that MMA regards trigonometric functions as more fundamental than exponential functions?

$\endgroup$
  • $\begingroup$ The arbitrary constants are arbitrary so you can change them at will. (DSolve[y''[x] + y[x] == 0, y[x], x][[1]] // TrigToExp) /. {C[1] :> 2 C[1], C[2] :> 2 C[2]} $\endgroup$ – Bob Hanlon Oct 31 '16 at 5:19
  • $\begingroup$ @BobHanlon So we can use GeneratedParameters -> (2 C[#] &) as the option together with the use of TrigToExp? $\endgroup$ – Αλέξανδρος Ζεγγ Oct 31 '16 at 6:02
  • $\begingroup$ Yes you can use the revised expressions. When you add initial conditions the arbitrary constants will resolve to satisfy the initial conditions whatever the form of the arbitrary constants. $\endgroup$ – Bob Hanlon Oct 31 '16 at 6:08
  • $\begingroup$ eqn = y''[x] + y[x] == 0; soln = DSolve[eqn, y, x, GeneratedParameters -> (2 C[#] &)][[1]] // TrigToExp; eqn /. soln evaluates to True $\endgroup$ – Bob Hanlon Oct 31 '16 at 6:18
  • $\begingroup$ @BobHanlon I believe you have an unmatched square bracket. $\endgroup$ – Soldalma Oct 31 '16 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.