I have the following problem:
I want to multiply two matrices and sum them to another matrix C. A.B+ 2B Easy! The matrix A varies as a function of three inputs a,b and c. The second matrix, B, is a 2x2 identity matrix.
here is the code
Grid[{{"a", "b", "c"},
{InputField[Dynamic[a], FieldSize -> 1],
InputField[Dynamic[b], FieldSize -> 1],
InputField[Dynamic[c], FieldSize -> 1]}}]
A = {{Dynamic[a]*Dynamic[b], 0}, {0, Dynamic[c]}};
B = IdentityMatrix[2];
A.B + 2 B
Let's say a=c=10 and b=2.
But I don't want to get 10 2+2 and 10+2, I need 22 and 12! It just shows the value of a and c without multiplying.
Using
A = {{Dynamic[a*b], 0}, {0, Dynamic[c]}};
instead of
A = {{Dynamic[a]*Dynamic[b], 0}, {0, Dynamic[c]}};
solves the first problem. I got 20+2 and 10+2, which is good but not enough.
It seems that it not possible to simplify operation when using Dynamic... How can I solve the problem? Thx!