# Why my solve doesn't work?

I want mathematica to recognize an expression. Thus I followed the ideas developed here and I wrote :

Solve[polynomelhs ==
1/3 (1 + 2 J) (3 J + 3 J^2 + j4 + j4^2) (J + J^2 + 3 j4 + 3 j4^2) &&
Cj4 == j4*(j4 + 1)  && CJ == J (J + 1) && DJ == 2*J + 1,
{polynomelhs}, {j4}, {J}]


I want that mathematica answers me polynomelhs->(1/3)*DJ*(3*CJ+Cj4)(CJ+3Cj4)

But it does'nt work.

I even cleared all my variables just before the solve but it doesn't work still.

Why isn't it working ?

The error is : Solve::bddom: Value {J} of the domain argument should be Complexes, Reals, Algebraics, Rationals, Integers, Primes, or Automatic.

I never needed to specify the domain argument before so why do I need to do it now ?

• Your syntax for the Solve command is incorrect. I think your set of equations may have more than one solution. – mikado Jun 17 '17 at 17:15
• Your 3rd argument {J} is in the position where Solve expects a domain specification, which explains the error message you see. – m_goldberg Jun 17 '17 at 17:39

eqns = polynomelhs ==
1/3 (1 + 2 J) (3 J + 3 J^2 + j4 + j4^2) (J + J^2 + 3 j4 +
3 j4^2) && Cj4 == j4*(j4 + 1) && CJ == J (J + 1) &&
DJ == 2*J + 1;


Use Reduce rather than Solve. Note that the variables to be eliminated must be in a single list. The fourth argument in your Solve was interpreted as an invalid domain specification.

sol = Reduce[eqns, polynomelhs, {j4, J}] // ToRules

(*  {CJ -> 1/4 (-1 + DJ^2),
polynomelhs ->
1/48 DJ (3 - 40 Cj4 + 48 Cj4^2 - 6 DJ^2 + 40 Cj4 DJ^2 + 3 DJ^4)}  *)


FullSimplify the expression for polynomelhs using the solution given for CJ as an assumption

FullSimplify[polynomelhs /. sol, Equal @@ sol[[1]]]

(*  1/3 (3 CJ + Cj4) (CJ + 3 Cj4) DJ  *)


EDIT: Solve will work if you specify that you also want to know the variable CJ

sol2 = Solve[eqns, {polynomelhs, CJ}, {j4, J}][[1]]

(*  {polynomelhs ->
1/48 DJ (3 - 40 Cj4 + 48 Cj4^2 - 6 DJ^2 + 40 Cj4 DJ^2 + 3 DJ^4),
CJ -> 1/4 (-1 + DJ^2)}  *)

FullSimplify[polynomelhs /. sol2, Equal @@ sol2[[2]]]

(*  1/3 (3 CJ + Cj4) (CJ + 3 Cj4) DJ  *)

• Why is reduce better than solve in this case ? Thank you !! – StarBucK Jun 18 '17 at 13:00
• @StarBucK - The algorithms used by Reduce are more powerful and handle more cases than those used by Solve. When Solve didn't work with the input, I tried adding the option Method-> Reduce, and when that didn't work I switched to Reduce. "If at first you don't succeed, get a bigger hammer." – Bob Hanlon Jun 18 '17 at 15:24