I was using Sympy in Python to conduct some Matrix operations. I have found that Matrix in Sympy cannot process complex automatically. For an easy example
Matrix([[-3007.52907429211/(2898092.62249243 - 706897.569072986*I) - 1/(-138.749949129781 - 2.9947535188934*I) + 5926.32998065723*I/(2898092.62249243 - 706897.569072986*I), 69.4741898294738/(-20767.5225629041 + 5543.00153023887*I) - 42.6513068752839*I/(-20767.5225629041 + 5543.00153023887*I)], [69.4741898294738/(-20767.5225629041 + 5543.00153023887*I) - 42.6513068752839*I/(-20767.5225629041 + 5543.00153023887*I), -1/(148.74433463588 - 43.1600457323684*I)]])
I have tried .expand and it doesn't work. I think there must be a way to let Matrix compute complex I automatically. Please let me know. Thank you!
I'm assuming you have imported I
as you aren't reporting stack trace type errors.
In which case, you need to add the complex=True
argument to .expand()
m = <Your matrix values from above>
simplified_m = m.expand(complex=True)
I am not 100% sure why this is necessary - if the reason behind it is important to you, I can research further.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments