Transform a DSolveValue solution into a reasonable form

Here are two equations:

    eq1 = D[z[x], {x, 4}] + z[x] == 0;
eq2 = D[z[x], {x, 4}] + q^4*z[x] == 0;


They only differ from one another by the scale factor q^4, where q>0. I need to solve them in real numbers. If I solve the first one I get

  DSolveValue[eq1, z[x], x]

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


which is convenient to look at. However, if I solve the second one, I get:

 DSolveValue[eq2, z[x], x]

(*  E^((-1)^(3/4) q x) C[1] + E^(-(-1)^(1/4) q x) C[2] + E^(-(-1)^(3/4) q x) C[3] + E^((-1)^(1/4) q x) C[4]   *)


which is alredy less convenient. Since q is real and positive, it is obvious, that the solution is like the solution of eq1, in which we make a replacement: x->q*x:

    DSolveValue[eq1, z[x], x] /. x -> q*x

(* E^((q x)/Sqrt[2]) C[1] Cos[(q x)/Sqrt[2]] + E^(-((q x)/Sqrt[2])) C[2] Cos[(q x)/Sqrt[2]] + E^(-((q x)/Sqrt[2])) C[3] Sin[(q x)/Sqrt[2]] + E^((q x)/Sqrt[2]) C[4] Sin[(q x)/Sqrt[2]]  *)


However, I cannot find a regular operation which would transform the solution of eq2 into this form.

Any idea?

• Dirty trick, not recommended: DSolveValue[D[z[x], {x, 4}] + EulerGamma^4*z[x] == 0, z, x] /. EulerGamma -> q. (Any positive symbolic constant could have worked just as well.) Oct 5, 2016 at 11:43
• @ J. M. I admire this trick, the more that one can use, say, Pi instead of the EulerGamma . However, I am preparing this for students, and poor students will go crazy with such tricks. They need something more regular. Oct 5, 2016 at 12:33
• Yes, that's why I emphasized "not recommended"... I tried Assumptions, but it does nothing useful in this case. Oct 5, 2016 at 12:34
• Similar to questions 126132 and 126768. Oct 6, 2016 at 11:33
• @ bbgodfrey Thank you. As much as I understood from your answer, there is no satisfactory answer, as yet, right? Oct 6, 2016 at 15:48

eq2 = D[z[x], {x, 4}] + q^4*z[x] == 0;
sol = DSolveValue[eq2, z[x], x]


sol2 = ComplexExpand@sol


rule = First@
Solve[{C[1] + C[2] == a, C[3] + C[4] == b, I (C[1] - C[2]) == c,
I (-C[3] + C[4]) == d}, {C[1], C[2], C[3], C[4]}]


sol2 /. rule // Expand


eq1 = D[z[x], {x, 4}] + z[x] == 0;
eq2 = D[z[x], {x, 4}] + q^4*z[x] == 0;

sol1 = DSolveValue[eq1, z[x], x]


The terms without the GeneratedParameters are

terms1 = List @@ sol1 /. C[_] :> 1


Using distinct GeneratedParameters for sol2

sol2 = DSolveValue[eq2, z[x], x,
GeneratedParameters -> d]


Finding the relations between the two sets of GeneratedParameters

rules =
Solve[
(Coefficient[sol1 , #] & /@ terms1) ==
(Coefficient[
sol2 /. q -> 1 //
ComplexExpand[#, Array[d, 4]] &,
#] & /@ terms1)], Array[d, 4]][[1]] //
Simplify[#, Element[Array[C, 4], Reals]] &


Substituting the GeneratedParameters

sol2 = sol2 /. rules // ComplexExpand


Verifying

sol1 == (sol2 /. q -> 1)

(*  True  *)