First, without tensor fields:
reset()
H=function('H',imag_part_func=0)(x)
term1=(1/2)*sqrt(2)*sqrt(I*H)
term2=(1/2)*sqrt(2)*sqrt(-I*H)
result=(term1*term2).canonicalize_radical()
print(result)
This gives the result: -1/2*H(x)
However, when term1
and term2
are the elements of tensors as in
reset()
Man=Manifold(4, 'Man', r'\mathcal{M}')
BL.<t,r,th,ph> = Man.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
H=function('H',imag_part_func=0)(x)
term1=(1/2)*sqrt(2)*sqrt(I*H)
term2=(1/2)*sqrt(2)*sqrt(-I*H)
T1=Man.tensor_field(0,1,[0,0,term1,0])
T2=Man.tensor_field(0,1,[0,0,term2,0])
result=T1[2]*T2[2]
print(result)
I get, 1/2*I*H(x)
I need to get -1/2*H(x)
as in the first case. I can solve my problem by using .expr()
for the elements of the tensor:
reset()
Man=Manifold(4, 'Man', r'\mathcal{M}')
BL.<t,r,th,ph> = Man.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
H=function('H',imag_part_func=0)(x)
term1=(1/2)*sqrt(2)*sqrt(I*H)
term2=(1/2)*sqrt(2)*sqrt(-I*H)
T1=Man.tensor_field(0,1,[0,0,term1,0])
T2=Man.tensor_field(0,1,[0,0,term2,0])
result=(T1[2].expr()*T2[2].expr()).canonicalize_radical()
print(result)
But is there a way to get the result I needed without .expr()
? I think I am missing something about the tensor fields.