# Dynamic input for Complex, Determinant output problems [duplicate]

I'm having trouble using Complex with Dynamic real and imaginary inputs. The inputs come from a matrix of popup menus:

InitA = {
};


Using those dynamic inputs, I set the parts of a new matrix equal to those dynamic inputs.

a11 = Complex[Dynamic[a11re], Dynamic[a11im]];
a12 = Complex[Dynamic[a12re], Dynamic[a12im]];
a21 = Complex[Dynamic[a21re], Dynamic[a21im]];
a22 = Complex[Dynamic[a22re], Dynamic[a22im]];
A = {{a11, a12},
{a21, a22}};


For some reason, the matrix A isn't read as 4 complex numbers, but just four inputs of the form Complex[Re, Im]. If I remove the Dynamic[] around the variables when using Complex[], A displays 4 complex numbers in TraditionalForm. Does anyone know about the behavior of Complex that restricts it from using dynamic inputs?

EDIT

Later in the application, Det[A] must be found. Using JM's suggestion for creating the complex numbers in A, with initial inputs of A as:

a11re = 2; a11im = -4; a12re = 2; a12im = 0;
a21re = 3; a21im = 0; a22re = 5; a22im = -3;
a11 = Dynamic[a11re + I*a11im];
a12 = Dynamic[a12re + I*a12im];
a21 = Dynamic[a21re + I*a21im];
a22 = Dynamic[a22re + I*a22im];


Det[A]//TraditionalForm outputs "2-4i5-3i-23", which is (2-4i)(5-3i)-(2)(3) without the parenthesis. Why would it not evaluate the determinant fully? That just doesn't make sense to me.

• Use an explicit construction instead: Dynamic[a11re + I a11im]. Complex requires explicit numbers (i.e. satisfies NumberQ[]). – J. M. will be back soon Jun 20 '16 at 16:16
• Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Jun 20 '16 at 16:36
• take a look here: 85491 and at a possible duplicate: 5820 – Kuba Jun 20 '16 at 17:58
• Condensing into a comment: 1 is a number and can be used everywhere where a number is expected. Dynamic[1] is not a number and cannot be used in such places. Dynamic[expr] is a way to display expr and automatically recompute it any time a subpart changes. Things wrapped in Dynamic cannot be used for computation. If it's a determinant you want to display and update dynamically, Dynamic must appear once, wrapping Det. – Szabolcs Jun 20 '16 at 18:02
• Thank you Szabolcs! That did the trick! Also thanks to J.M. for his initial response! – J_Nat Jun 20 '16 at 18:15

Thanks to J.M. and Szabolcs for addressing my questions clearly. Here's what they came up with:

I was using Dynamic incorrectly, wrapping variables that weren't being displayed.

The new code is now this

InitA = {