4
$\begingroup$

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[75], a[74], a[73], a[72], a[71], a[70]}]

I receive the error:

"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?

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

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[70] -> -(idirt[70, 6]/ itime[70, 6]), a[71] -> -(idirt[71, 6]/itime[71, 6]), a[72] -> -(idirt[72, 6]/ itime[72, 6]), a[73] -> -(idirt[73, 6]/itime[73, 6]), a[74] -> -(idirt[74, 6]/ itime[74, 6]), a[75] -> -(idirt[75, 6]/itime[75, 6])}\}$

values = var /. soln[[1]]

$\{-(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])\}$

$\endgroup$
  • $\begingroup$ 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[[1]] $\endgroup$ – aiwass Oct 3 '16 at 16:26

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.