This is a situation where I am trying to multiply a 3x3 array by a 3x1 array of variables
Asuperworst Out[96]: array([[7.84613528e+04, 4.07395485e+03, 4.56960842e-13],
[4.07395485e+03, 1.43342856e+05, 7.48873168e-12],
[4.56960842e-13, 7.48873168e-12, 1.03500000e+04]])
exmatrixmax=np.array([['exmax'],['eymax'],['exymax']])
NXMatrixMaxWorst=np.dot(Asuperworst,exmatrixmax)
NXMatrixMaxWorst=np.dot(Asuperworst,exmatrixmax)
TypeError: Cannot cast array data from dtype('float64') to dtype('<U32') according to the rule 'safe' I understand that the issue is that the float64 is incompatible with but I just need to be able to multiply these together to make something like
NXMatrixMaxWorst= np.array[[78450exmax + 4080eymax], [4.08exmax+143.3eymax],[10.35exymax]
This way I can set the NXMatrixMaxWorst equal to something such as [[NMX],[0],[0]] and run the calculation for the NMX variable and to calculate for exmax, eymax, and exymax for all values in the list
Also, for a similar situation I need to be able to determine the NXMatrixMaxWorst for a list of Asuperworst value such as
Afinal Out[100]: [array([[69408.1197441 , 1357.98495151, 0.],
[ 1357.98495151, 4526.61650505, 0. ],
[ 0. , 0. , 3450. ]]),
array([[0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 9.09494702e-13, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00]])]
Any help that can be provided would be most appreciated. I'm new to this and it has been an uphill battle the whole way
First problem to address here is the incompatible data types, for this you need to first check which array is causing the trouble, run this to check
Based on the TypeError you are seeing, one of these array is of type U32 (unsigned 32 bit). If all of your values in both the matrices remain positive always you can choose to convert the one which is not of U32 type to U32 like this
If positive values are not ensured, then to be on safe side you can cast the matrices to 'float64' (just replace 'U32' with 'float64'
Once the data types have been taken care of, we move on to finding NXMatrixMaxWorst as follows-
Finally, If you want to calculate NXMatrixMaxWorst for multiple Asuperworst matrices follow this-