In Python 4j is the literal syntax to create an imaginary number (0 +
4*I). You need to use 4*j.

On Mon, 4 Jan 2021 at 10:10, Thomas Ligon <[email protected]> wrote:
>
> My understanding is that Sympy uses I as sqrt(-1), but I am running into a 
> problem with j. I have defined j as a symbol, but j**2 is sometimes returning 
> -1.
> Here is the code:
>
> from sympy import latex
> from sympy import symbols, sqrt
> m = symbols('m')
> j = symbols('j')
> s = symbols('s')
> print(sqrt(-1))
> print(latex(sqrt(-1)))
> print(latex(-((s)/(j))*(4*(j-1)*s+4*j**2+4*j-2-4*(s-j+1)*m+m**2)/(2*(4j**2-1)-4*m+m**2)))
> # print gives:
> # - \frac{s \left(4 j^{2} + 4 j + m^{2} - m \left(- 4 j + 4 s + 4\right) + s 
> \left(4 j - 4\right) - 2\right)}{j \left(m^{2} - 4 m - 34.0\right)}
> # in other words, all "j" are symbols except that j**2 == -1
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/50ead3a4-846a-4b6d-979c-2605d4cbc992n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxTge5AJLh3DR_8rogAOCMN7ZmrsgQi8uHDKbo0nd_CKOw%40mail.gmail.com.

Reply via email to