# Solving System of Equations where the Variables are Array References

New to MMA. I am trying to solve equations where the unknown variables are array references $a[x]$ and the known coefficients are obtained by evaluating the value of functions at points $idirt[x,t]$ and $itime[x,t]$:

t = 6
xn3 = Table[idirt[X, t] == -a[X]*itime[X, t], {X, 75, 70, -1}]
Solve[{xn3}, {a, a, a, a, a, a}]


"is not a quantified system of equations and inequalities."


Additionally, is there a way to specify a range of array values to solve for $a[70-75]$, or do they need to all be written out like I have done?

• Solve[xn3,...'] should work, i.e. drop the {} around xn3. You can specify variables with e.g. Map[a, Range[70, 75]]. – Marius Ladegård Meyer Oct 3 '16 at 14:49

Note that a[x] is not an array reference but rather an indexed variable. References to part of an array or vector are done with Part ([[...]])

t = 6;

var = a /@ Range[70, 75];

xn3 = Table[idirt[X, t] == -a[X]*itime[X, t], {X, 70, 75}];

soln = Solve[xn3, var]


$\{{a -> -(idirt[70, 6]/ itime[70, 6]), a -> -(idirt[71, 6]/itime[71, 6]), a -> -(idirt[72, 6]/ itime[72, 6]), a -> -(idirt[73, 6]/itime[73, 6]), a -> -(idirt[74, 6]/ itime[74, 6]), a -> -(idirt[75, 6]/itime[75, 6])}\}$

values = var /. soln[]


$\{-(idirt[70, 6]/itime[70, 6]), -(idirt[71, 6]/itime[71, 6]), -(idirt[72, 6]/itime[72, 6]), -(idirt[73, 6]/itime[73, 6]), -(idirt[74, 6]/itime[74, 6]), -(idirt[75, 6]/itime[75, 6])\}$

• Thanks! I am now trying to store these solutions as values rather than rules via /. but am having issues: sol3 = Solve[xn3, var] solutions[var] = sol3[] – aiwass Oct 3 '16 at 16:26