Hello,
I have been playing a bit with the number classes, and I have come
across Integer, Real and Rational classes. Comparing to their "native"
counterparts in CPython, I understand they correspond to int, float
and the Fraction (from the fractions) objects respectively. Good so
far, I also looked around in the code and understand how the
comparison works.
One thing I haven't found out (after fair searching around) is how do
I create a complex number (not a symbol as complex)? For example, I
can do this to create a SymPy floating point number:
>>> from sympy import Float
>>> f=Float(1.4)
How can I create a number such as 1+4j?
Also, considering this:
>>> f.is_complex
True
which is fair, I understand, how do I assign the imaginary component
if that's the way i want to go about it?
Regarding declaring symbols as complex:
With explicit complex assumption set:
>>> x=Symbol('x',complex=True)
>>> x1 = x+1j
Generic symbol:
>>> x=Symbol('x')
>>> x2=x+1j
How are the above two different? I know they are:
>>> x1==x2
False
Even though the structure of both the above expressions are the same,
the test evaluates to False.
Thanks in advance for clarifying my doubts.
Best,
Amit.
--
http://echorand.me
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.