1
$\begingroup$

An example that could explain my question is as follows,

Solve[{a1 x + b1 y + c1 z, a2 x + b2 y + c2 z} == 0]

I want to set a1, b1, c1, a2, b2 and c2 to be free parameters while solving the two linear equations in x, y and z. I do not want to use the following code

Solve[{a1 x + b1 y + c1 z, a2 x + b2 y + c2 z} == 0, {x, y}]

since in general there might be lots of free parameters like a1 and lots of variables like x, I do not know which variables could be solved as a function of other variables. Put it in another word, I want Mathematica to choose the variables to solve, I only want to set some variables to be free parameters so that Mathematica does not need to solve them!

Edit, the equations are

Solve[{x[1, 0]^2 + 2 x[1, 1] x[1, 2], x[1, 1]^2 + 2 x[1, 0] x[1, 2], x[1, 0]^2 + 2 x[1, 1] x[1, 2], x[1, 1]^2 + 2 x[1, 0] x[1, 2], c[0] x[1, 0]^4 + c[3] x[1, 0]^2 x[1, 1]^2 + c[1] x[1, 1]^4 + 
c[4] x[1, 0] x[1, 1] x[1, 2]^2 + c[2] x[1, 2]^4} == 0]

I want to set c[0], c[1], c[2], c[3] and c[4] to be free parameters, and solve equations.

$\endgroup$
7
  • $\begingroup$ In what form do you get the parameters and variables, please give a concrete example. $\endgroup$
    – Feyre
    Dec 21 '16 at 16:47
  • $\begingroup$ There are multi-polynomial equations, and there are five polynomial equations which contain 12 variables and 5 free parameters! $\endgroup$
    – Wenzhe
    Dec 21 '16 at 17:01
  • $\begingroup$ Can you post what such a polynomial looks like? $\endgroup$
    – Feyre
    Dec 21 '16 at 17:06
  • $\begingroup$ @Feyre Thank you very much for your patience, the equations have been added to the question. $\endgroup$
    – Wenzhe
    Dec 21 '16 at 17:24
  • 1
    $\begingroup$ It seems you simultaneously know, and do not know, which are your variables. That's an uncomfortable situation even to contemplate. $\endgroup$ Dec 21 '16 at 22:02
4
$\begingroup$

Let

f = {x[1, 0]^2 + 2 x[1, 1] x[1, 2], x[1, 1]^2 + 2 x[1, 0] x[1, 2], 
   x[1, 0]^2 + 2 x[1, 1] x[1, 2], x[1, 1]^2 + 2 x[1, 0] x[1, 2], 
   c[0] x[1, 0]^4 + c[3] x[1, 0]^2 x[1, 1]^2 + c[1] x[1, 1]^4 + 
    c[4] x[1, 0] x[1, 1] x[1, 2]^2 + c[2] x[1, 2]^4};

Then, isolate what to solve for:

var = Select[Variables[f], FreeQ[c]];

Solve the equations:

Solve[Join[{# == 0}, Thread[var != 0]], var] & /@ f

{{{x[1, 2] -> -(x[1, 0]^2/(2 x[1, 1]))}}, {{x[1, 2] -> -(x[1, 1]^2/( 2 x[1, 0]))}}, {{x[1, 2] -> -(x[1, 0]^2/(2 x[1, 1]))}}, {{x[1, 2] -> -(x[1, 1]^2/(2 x[1, 0]))}}, {{x[1, 2] -> -(1/Sqrt[ 2])(√(-((c[4] x[1, 0] x[1, 1])/c[2]) - (1/ c[2])(√(-4 c[0] c[2] x[1, 0]^4 - 4 c[2] c[3] x[1, 0]^2 x[1, 1]^2 + c[4]^2 x[1, 0]^2 x[1, 1]^2 - 4 c[1] c[2] x[1, 1]^4))))}, {x[1, 2] -> (1/Sqrt[ 2])(√(-((c[4] x[1, 0] x[1, 1])/c[2]) - (1/ c[2])(√(-4 c[0] c[2] x[1, 0]^4 - 4 c[2] c[3] x[1, 0]^2 x[1, 1]^2 + c[4]^2 x[1, 0]^2 x[1, 1]^2 - 4 c[1] c[2] x[1, 1]^4))))}, {x[1, 2] -> -(1/Sqrt[ 2])(√(-((c[4] x[1, 0] x[1, 1])/c[2]) + (1/ c[2])(√(-4 c[0] c[2] x[1, 0]^4 - 4 c[2] c[3] x[1, 0]^2 x[1, 1]^2 + c[4]^2 x[1, 0]^2 x[1, 1]^2 - 4 c[1] c[2] x[1, 1]^4))))}, {x[1, 2] -> (1/Sqrt[ 2])(√(-((c[4] x[1, 0] x[1, 1])/c[2]) + (1/ c[2])(√(-4 c[0] c[2] x[1, 0]^4 - 4 c[2] c[3] x[1, 0]^2 x[1, 1]^2 + c[4]^2 x[1, 0]^2 x[1, 1]^2 - 4 c[1] c[2] x[1, 1]^4))))}}}

$\endgroup$
1
  • $\begingroup$ Thank you, this is what I want! $\endgroup$
    – Wenzhe
    Dec 21 '16 at 18:36
1
$\begingroup$

Your system has no meaning fo Mathematica sin x[something] calls a function which is not defined

For instance you must write : x[a_]:= a x and call x[a] to apply x to a --- the same for multiple variables. In your case, if I have understood correctly your problem you must writ something like

Solve[{Subscript[x, 10]^2 + 2 Subscript[x, 11] Subscript[x, 12], 
   Subscript[x, 11]^2 + 2 Subscript[x, 10] Subscript[x, 12], 
   Subscript[x, 10]^2 + 2 Subscript[x, 11] 2, 
   Subscript[x, 11]^2 + 2 Subscript[x, 10] Subscript[x, 12], 
   Subscript[c, 0] Subscript[x, 10]^4 + 
    Subscript[c, 3] Subscript[x, 10]^2 Subscript[x, 11]^2 + 
    Subscript[c, 1] Subscript[x, 10]^4 + 
    Subscript[c, 4][4] Subscript[x, 10] Subscript[x, 11]
      Subscript[x, 12]^2 + Subscript[c, 2] Subscript[x, 12]^4} == {0, 
   0, 0, 0, 0}, {Subscript[x, 10], Subscript[x, 11], Subscript[x, 
  12]}]

whose solution is {0, 0, 0, 0, 0}, because its a singularity in your space. If only one equation is not equal to zero you have no solution by radicals because after reduction your equation will be of an order largely greater than 5. You can make some numeric association with parameters and use NSolve. One more time if I have understood your question.

$\endgroup$
0

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.