This looks like a bug. It looks like it is multiplying and dividing by the conjugate, which, if it were one over a complex number, would put it in the form a + b*I. But whatever code does this is not correctly checking if the expression is symbolic.
Can you open an issue for it? Aaron Meurer On Fri, Nov 11, 2011 at 3:32 PM, smichr <[email protected]> wrote: > Does anyone know why the conjugates appear sometimes during evalf'ing? > > >>> d=(.3+.2*sin(x)) > >>> for di in d.args: > ... print di.n(), (1/di).n() > ... > 0.300000000000000 3.33333333333333 > 0.2*sin(x) 5.0/sin(x) > >>> d.n() > 0.2*sin(x) + 0.3 > > So far so good. but now: > > >>> (1/d).n() > 0.2*sin(conjugate(x))/(0.04*sin(x)*sin(conjugate(x)) + 0.06*sin(x) > + 0.06*sin(co > njugate(x)) + 0.09) + 0.3/(0.04*sin(x)*sin(conjugate(x)) + > 0.06*sin(x) + 0.06*si > n(conjugate(x)) + 0.09) > > and it doesn't have to do with Floats: > > >>> d=(1+2*sin(x)) > >>> (1/d).n() > 2.0*sin(conjugate(x))/(4.0*sin(x)*sin(conjugate(x)) + 2.0*sin(x) + > 2.0*sin(conju > gate(x)) + 1) + 1/(4.0*sin(x)*sin(conjugate(x)) + 2.0*sin(x) + > 2.0*sin(conjugate > (x)) + 1) > > If x is made real then this doesn't happen: > > >>> var('x',real=True) > x > >>> d=(1+2*sin(x)) > >>> (1/d).n() > 1/(2.0*sin(x) + 1) > > -- > 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. > > -- 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.
