Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24474 from Kishore96in/fix_imag_tens_print_onmaster
tensor: fix printing of TensMul with imaginary coefficients
- Loading branch information
Showing
3 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from sympy.tensor.tensor import TensorIndexType, tensor_indices, TensorHead | ||
from sympy import I | ||
|
||
def test_printing_TensMul(): | ||
R3 = TensorIndexType('R3', dim=3) | ||
p, q = tensor_indices("p q", R3) | ||
K = TensorHead("K", [R3]) | ||
|
||
assert repr(2*K(p)) == "2*K(p)" | ||
assert repr(-K(p)) == "-K(p)" | ||
assert repr(-2*K(p)*K(q)) == "-2*K(p)*K(q)" | ||
assert repr(-I*K(p)) == "-I*K(p)" | ||
assert repr(I*K(p)) == "I*K(p)" |