0
$\begingroup$

Say I have a simple function

F[x_, y_, z_, r_, a_, b_, c_, d_] := (1 - a + b - (b/3) (c x + d (y + z + r))) x

And I want to solve the set of equations given by:

x == F[x,y,z,r,a,b,c,d]
y == F[y,x,z,r,a,b,c,d]
z == F[z,x,y,r,a,b,c,d]
r == F[r,x,y,z,a,b,c,d]

The variables are x,y,z,r; a,b,c,d are parameters; and the only important position is the first of the 4 variables in each equation of the type x==F[x,y,z,r,...]

I figured I should solve this system by the command

Solve[Diagonal[Table[m==n,{m,{x,y,z,r}},{n,{F[x,y,z,r,a,b,c,d],F[y,x,z,r,a,b,c,d],F[z,y,x,r,a,b,c,d],F[r,y,z,x,a,b,c,d]}}]],{x,y,z,r}]

However, Mathematica doesn't evaluate the Solve command, it simply prints back the command without giving it a try...

  • What am I missing?

  • Is there a simpler way to build the system of equations?

  • Is it possible to do for any number of variables? (here, I have 4 variables, ideally I'd want it working for n variables)

In math, the general system of equations would look like this:

$$
\vec{x}=\vec{F}(\vec{x})
$$

and I want to solve for each component of $\vec{x}$

$\endgroup$

1 Answer 1

3
$\begingroup$

Are you sure you had defined F before trying Solve? Is the F in your notebook blue (undefined) or black (properly defined)? Does Solve return an error of any kind?

This is what I get:

ClearAll[F]
F[x_, y_, z_, r_, a_, b_, c_, d_] := (1 - a + b - (b/3) (c x + d (y + z + r))) x

Solve[
  {x == F[x, y, z, r, a, b, c, d], 
   y == F[y, x, z, r, a, b, c, d],
   z == F[z, y, x, r, a, b, c, d], 
   r == F[r, y, z, x, a, b, c, d]},
  {x, y, z, r}
]

enter image description here

$\endgroup$
2
  • $\begingroup$ I suspect F was defined as F[x,y,z,a,b,c,d] without the r $\endgroup$
    – Girardi
    Jul 8, 2020 at 17:03
  • 1
    $\begingroup$ @Girardi Yep that could be a reason as well. I tend to add a Clear before any function definition to make sure that old definitions don't linger etc. $\endgroup$
    – MarcoB
    Jul 8, 2020 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.