Hi, Short version of the question: How to take the real/imaginary part of a symbolic expression? Can real(x + I*y) give me "x" with the proper assumptions in place?
Here is the context: I'm implementing a small gaussian optics module that I am going to need during an internship. Here is my problem. There is a thing called complex beam parameter<http://en.wikipedia.org/wiki/Complex_beam_parameter>that is a complex number whose real part is a certain quantity describing the beam and the imaginary part is another such quantity. The formalism treats them together in this complex number. I want to have a class with the constructor: >>>a=Constructor(quantityA, quantityB) >>>a == quantityA + I*quantityB True with the assumptions that quantityA and quantityB are real. Then I want to have the selectors (@property decorators): >>>a.quantA quantityA >>>q.quantB quantityB My idea was just to define quantA as real(a) but as far as what the documentation or Google say there is no function "real" for a general symbolic expression in sympy. I suppose I have missed something. Can I take the real part of a general expression? Can real(x + I*y) give me "x" with the proper assumptions in place? Regars Stefan -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
