Convert all complex numbers in array/matrix to value 0 or remove these numbers
Hi all
I'm new to sagemath, approximately 2 week-old. How do you convert all complex numbers in a nested array to value 0 or NaN? Or to remove these numbers from the array/matrix(which is eventually what I want to achieve in the end)?
Thanks for your help!
Rgds Sam
Could you please provide an example of an array, and the expected result, it is not clear to me. Are all entries complex numbers ?
1)I did a "solve" on 2 nonlinear equations with variables var1 and var2. z = solve 2)I made 2 empty lists : var1_y = [], var2_y = [] then i appended the var 1 and var 2 solutions separately for solution in z: var1_y.append(var1.subs(solution)) var2_y.append(var2.subs(solution)) 3) then I combine them into matrix. How do I delete the rows with complex no? Thx! var1_y2 = matrix(var1_y).transpose() var2_y2 = matrix(var2)y).transpose() A = var1_y2.augment(var2_y2) [ 2 0] [ -1/10 0] [0.5186911103074608 - 0.8859791354693165I 0.1849665371636101 +0.1317620873508901I] [ 2.887006775607812 -0.1147163491731212
Try editing your question; comments don't leave you enough room to provide enough information.