# How do I handle complicated algebraic manipulations?

I have some complicated expressions which are defined below:

A[z_]:=(Sqrt[(2/a)*Sqrt[2]*(2*b^2-Λ^2)(Sqrt[2]*b+Λ)]*Cosh[Sqrt[2*b^2-Λ^2]*z])/(Sqrt[2]*b+Λ*Cosh[2*Sqrt[2*b^2-Λ^2]*z])
B[z_]:=(Sqrt[(2/a)*Sqrt[2]*(2*b^2-Λ^2)(Sqrt[2]*b-Λ)]*Sinh[Sqrt[2*b^2-Λ^2]*z])/(Sqrt[2]*b+Λ*Cosh[2*Sqrt[2*b^2-Λ^2]*z])

ψ1[z_,t_]:=A[z]*Exp[-I*Λ*t]
ψ2[z_,t_]:=I*B[z]*Exp[-I*Λ*t]

F1[z_,t_]:=(ψ1[z,t]+ψ2[z,t])/2;
F2[z_,t_]:=(ψ1[z,t]-ψ2[z,t])/2;


(It is known that A[z] and B[z] are real, a and b are positive reals, and Λ is real.)

I wish to simplify the following expressions in terms of the expressions defined above:

FullSimplify[Im[F1[z,t]*D[Conjugate[F2[z,t]],t]-
F1[z,t]*D[Conjugate[F2[z,t]],z]]]

FullSimplify[D[ψ1[z,t],t]+D[ψ2[z,t],z]+I*Sqrt[2]*b*ψ1[z,t]-I*(a/Sqrt[2])*ψ1[z,t]*(Abs[ψ1[z,t]^2-Abs[ψ2[z,t]^2]])]


(The second expression should probably simplify to zero.)

Unfortunately Mathematica takes forever to do this.

Is there a way to make this work? Also, are there any general tips with regard to manipulating complicated expressions in Mathematica?

• F1[z,t], F2[z,t] aren't defined yet! – Ulrich Neumann Dec 27 '17 at 18:22
• What is known about the several parameters? – Ulrich Neumann Dec 27 '17 at 18:28
• Your expressions involve taking derivatives of Conjugate. Mathematica has no built in model for this. You need to reformulate to avoid this (perhaps you can interchange D and Conjugate) – mikado Dec 27 '17 at 22:10
• @mikado, but the second expression does not have this problem. Thanks! – Navya Dec 28 '17 at 0:53
• @UlrichNeumann, it is known that $A[z]$ and $B[z]$ are real, $a$ and $b$ are positive reals, and $\Lambda$ is real. I added this information to the post. I also added the definition of $F1[z,t]$ and $F2[z,t]$. Thanks! – Navya Dec 28 '17 at 0:55

Sometimes, FullSimplify does not achieve the simplifications one might hope. Consider the second expression,

D[ψ1[z, t], t] + D[ψ2[z, t], z] + I*Sqrt[2]*b*ψ1[z, t] - I*(a/Sqrt[2])*ψ1[z, t]*
(Abs[ψ1[z, t]^2] - Abs[ψ2[z, t]^2]);


where I have taken the liberty of rewriting the two Abs arguments so that they are not nested (as I assume that the OP intended). Then, using FullSimplify with reasonable assumptions yields,

FullSimplify[%, a > 0 && b > 0 && 2 b^2 > Λ^2 && (Λ | t | z) ∈ Reals]

(* -(1/((Sqrt[2] b + Λ Cosh[2 z Sqrt[2 b^2 - Λ^2]])^2)) I 2^(1/4) E^(-I t Λ)
Cosh[z Sqrt[2 b^2 - Λ^2]] (-2 (-Sqrt[2] b^2 Sqrt[((Sqrt[2] b + Λ) (2 b^2 - Λ^2))/a] +
b (-Λ Sqrt[((Sqrt[2] b + Λ) (2 b^2 - Λ^2))/a] + Sqrt[((Sqrt[2] b - Λ)
(-2 b^2 + Λ^2)^2)/a]) + Sqrt[2] Λ (Λ Sqrt[((Sqrt[2] b + Λ) (2 b^2 - Λ^2))/a] +
Sqrt[((Sqrt[2] b - Λ) (-2 b^2 + Λ^2)^2)/a])) + Λ ((-2 b + Sqrt[2] Λ)
Sqrt[((Sqrt[2] b + Λ) (2 b^2 - Λ^2))/a] + Sqrt[2]
Sqrt[((Sqrt[2] b - Λ) (-2 b^2 + Λ^2)^2)/a]) Cosh[2 z Sqrt[2 b^2 - Λ^2]]) *)


which appears to be the best that FullSimplify can do without handholding. Yet, as suggested by the OP, inserting random numbers into this expression (with 2 b^2 > Λ^2, as required) yields zero to roundoff. Interestingly, FullSimplify has difficulty with even the simpler,

FullSimplify[(-(b - Λ) Sqrt[(b + Λ) (b^2 - Λ^2)] + Sqrt[(b - Λ) (b^2 - Λ^2)^2]) /.
b -> Sqrt[2] b, 2 b^2 > Λ^2 && b > 0]

(* Sqrt[Sqrt[2] b - Λ] (2 b^2 - Λ^2) + (-Sqrt[2] b + Λ) Sqrt[(Sqrt[2] b + Λ)
(2 b^2 - Λ^2)] *)


although not with the equivalent

FullSimplify[-(b - Λ) Sqrt[(b + Λ) (b^2 - Λ^2)] + Sqrt[(b - Λ) (b^2 - Λ^2)^2],
b^2 > Λ^2 && b > 0]
(* 0 *)