I want to do a calculation for general matrices from SU(2), i.e. I have a
a,b=symbols('a,b')
m=Matrix([[a,b],[-conjugate(b), conjugate(a)]])
and after some calculations i want sympy to simplify my result respecting that
abs(a)**2 + abs(b)**2 == 1.
Is there anyone with an idea how to tell sympy about this relation between a and b?
The easiest way to do this is to solve the equation for one expression and replace it. In this case, replace abs(a)**2 with 1 - abs(b)**2 (more generally, you can use solve to do this isolation for you).
So something like expr.subs(abs(a)**2, 1 - abs(b)**2). You may also need to replace a*conjugate(a) with abs(a)**2 (or rather, conjugate(a) with abs(a)**2/a) first to get things in terms of abs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With