# Solving a system of vector equations

I had a problem where I had to solve a series of equations where some of the variables can take multiple value such as shown below

c={0.0871817, 0.0850908, 0.0826321}

c={0.0874968, 0.0857884, 0.0838024}

d={2.23049*10^-6, 6.46928*10^-6, 0.0000128172}

d={2.04172*10^-6, 5.90291*10^-6, 0.0000116484}

d={1.86443*10^-6, 5.37164*10^-6, 0.0000105544}


And I'd like to solve for conc and conc

d*(c - conc) = d*(conc - conc)
d*(conc - conc) = d*(conc - c)


So I used Solve in such way

Solve[Thread[d*(c - conc) == d*(conc - conc)] &&
Thread[d*(conc - conc) == d*(conc - c)], {conc,
conc}]


which didn't gave me the right answer. I wonder if this is a legit approach or there's any other way to do it? I had a similar question yesterday that prompt me to use Thread for this kind of problems https://mathematica.stackexchange.com/questions/97054/solve-equation-with-a-variable-of-multiple-value I'm not sure if this method fit for my current problem.

Thanks for reading and let me know if you have any questions or suggestions!

• What kind of beasts are your conc[ ] supposed to be?Lists? Reals? Oct 15, 2015 at 20:49
• Yes, it's supposed to be a List with three values just like the other variables defined. Maybe I have to define those two to be Thread as well?
– Fang
Oct 15, 2015 at 20:53

conc = Array[x, 3];
conc = Array[y, 3];

Solve[d*(c    - conc) == d*(conc - conc) &&
d*(conc - conc) == d*(conc - c),
Flatten[{conc, conc}]]

(*
{{x -> 0.0872775, x -> 0.0853022, x -> 0.0829852,
y -> 0.0873822, y -> 0.0855338, y -> 0.0833736}}
*)

• How could I get the value from $x$,..$y$? these just return themselves expression. Mar 9, 2022 at 14:07

Because d (conc - conc) makes up one side of both equations, it can be eliminated, and the system is shown to be under-determined. Therefore, it has infinitely many solution sets. Belisarius's answer gives one of them, but I know no reason why it should be preferred.

Here is the general solution.

uu = Array[u, 3]; vv = Array[v, 3];
Solve[d (c - uu) == d (vv - c), Flatten @ {uu, vv}]


Solve::svars: Equations may not give solutions for all "solve" variables. >>

{v -> 0.191796 - 1.19634 u,
v -> 0.188267 - 1.20434 u,
v -> 0.18415 - 1.21439 u}


We can generate any specific solution with

sol[usol_] := Join[usol, gensol /. usol]


For example,

sol[{u -> 0., u -> 0., u -> 0.}]

{u -> 0., u -> 0., u -> 0.,
v -> 0.191796,  v -> 0.188267, v -> 0.18415}


or

sol[{u -> 0.08727751016208445,
u -> 0.08530217552915369,
u -> 0.08298516000872024}]

{u -> 0.0872775, u -> 0.0853022, u -> 0.0829852,
v -> 0.0873822, v -> 0.0855338, v -> 0.0833736}


which is belisarius' solution.

• The reason that this equation is under-determined is because I slightly changed my original code where the second equation is d[nodes - 2]*(conc[nodes - 2] - conc[nodes - 1]) == d[nodes - 1]*(conc[nodes - 1] - c[nodes]) plus an array function And @@ Array[ d[#]*(conc[#] - conc[# + 1]) == d[# + 1]*(conc[# + 1] - conc[# + 2]) &, nodes - 3, 1] I guess the answer I'm looking for is more like how to define a multi-value variable which belisarius suggested using the Array function. I might've overlooked the actual solution to my question. Thanks for pointing that out.
– Fang
Oct 15, 2015 at 23:18