For Sure Aaron, on it Issue Opened: Issue 4007<https://code.google.com/p/sympy/issues/detail?id=4007&q=irrational&colspec=ID%20Type%20Status%20Priority%20Milestone%20Reporter%20Summary%20Stars>
On Wednesday, September 4, 2013 4:44:23 AM UTC+5:30, Aaron Meurer wrote: > > This is definitely a bug. > > It looks like expand(complex=True) works. This is different from > expand_complex in that it also calls the other expand methods too, so that > it really ends up calling it on 1/(1 - I) and I/(1 - I). So for now, I > guess you will have to use expand(expr, complex=True).as_real_imag(). But > add a note that just as_real_imag() should work. > > Can you open an issue at http://code.google.com/p/sympy/issues/list about > this. > > If you want, you can also look into fixing it. Since (1 + I)/(1 - I) is > represented as Mul(1 + I, Pow(1 - I, -1)), the relevant code is > Mul.as_real_imag in sympy/core/mul.py. It looks like the algorithm is not > very general there. I think it works for 1/(1 - I) and I/(1 - I) because it > works when one of the arguments is completely real or completely imaginary, > but it should probably split it in the general case, at least when > deep=True. Let me know if you want to take a shot at fixing this, and I > can help you out if you can't figure something out. > > Aaron Meurer > > > On Tue, Sep 3, 2013 at 11:19 AM, Chetna Gupta <chet...@gmail.com<javascript:> > > wrote: > >> Inorder to get the real and imaginary parts of an irrational function, i >> have tried the following functions >> 1) as_real_imag() >> 2) expand_complex() >> >> While they work for most of the cases, both of them seem to fail when I >> have irrational functions in the denominator. >> >> For example for the case (i + i)/(i-I) I get the following outputs and >> not simply 0, i. Could someone suggest wayout to derive the real and imag >> parts for such cases other than above. While i have implemented a method >> for doing the same in >> https://github.com/sympy/sympy/pull/2380/files#L5R82_ (that is >> real_imag in prde.py) it does not takes into account more general cases. >> Any suggestions for making it to work for cases when I have arbitrary >> expressions, not just rational functions as coefficients of the arguments >> >> >> <https://lh4.googleusercontent.com/-lV8yyuvCwsY/UiYXK3BOz1I/AAAAAAAAB08/iQrn_o7gta0/s1600/Screenshot+from+2013-09-03+22%3A36%3A17.png> >> >> -- >> 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 sympy+un...@googlegroups.com <javascript:>. >> To post to this group, send email to sy...@googlegroups.com <javascript:> >> . >> Visit this group at http://groups.google.com/group/sympy. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.