# Issue with replacement rules screwing up a matrix [closed]

I am pretty new to using Mathematica as more than a calculator. Essentially my problem is that I am trying to calculate a quantity vector quantity

$x=x_0 - A^{-1}F(x_0)$

where $x_0$ is a 3-entry column vector (of numbers), $A^{-1}$ is the inverse of a 3x3 matrix of functions of three variables, and $F$ is a column vector of three functions of the same three variables. Clearly in order to get a numerical result I need to multiply $A^{-1}$ and $F$ together and replace the three variables with numerical values.

I tried doing it like

x=x_0 - ((AIinv * F)/.{x_1->1, x_2->1, x_3->1})


where those numerical values for the variables are just some that I made up just now. The thing is that when I apply the replacement rules the term (AInv * F) loses its matrix form and turns into a "multidimensional array", which prevents me from subtracting it from $x_0$. In order to fix it I have tried applying MatrixForm[] and Flatten[] and the two in combination to the (AInv*F) term but it does not help. It seems like this would all work great if this wasn't happening. I would appreciate anybody's help!! Thanks much

## closed as off-topic by Daniel Lichtblau, user9660, MarcoB, m_goldberg, Yves KlettFeb 12 '16 at 8:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, Community, MarcoB, m_goldberg, Yves Klett
If this question can be reworded to fit the rules in the help center, please edit the question.

• x_0 gives (0). Consider renaming it as x0. – thedude Feb 11 '16 at 4:40
• it's actually x{sub}0 with the build in typesetting (on my mac it's control hyphen) – Ern Feb 11 '16 at 4:42
• The proper syntax is Subscript[x, 0], but still try renaming all as x1, x2 etc. – thedude Feb 11 '16 at 4:43
• It might be easier for us to help if you copy the definitions of F and A1inv into your post. In addition, while x_0 can be interpreted as Subscript[x,0], it's better if you post code in completely correct Mathematica code format, so that potential answerers on this site can copy and paste your code into their own copies of Mathematica, facilitating quick answers. – march Feb 11 '16 at 4:53
• You will want to have a close look at documentation for Dot (used e.g. for matrix-times-vector) and also MatrixForm. That latter is a wrapper for formatting and will change the Head from List to MatrixForm, which will make further computation difficult. – Daniel Lichtblau Feb 11 '16 at 15:30

A = x1 x2 x3 RandomReal[1, {3, 3}];

• That should probably be Inverse[A].f, but in practice, LinearSolve[A, f] is the preferred route. – J. M. will be back soon Feb 11 '16 at 18:08