Keep in mind that indefinite integrals are only defined up to a
constant. simplify(u.diff(x) - c(x)*c(x-y)) gives 0, which
demonstrates that the integral is correct.

As to why they are different, for some reason, integrate isn't giving
arctangents in the former case. This could be considered a bug
(integrate() should avoid introducing complex numbers whenever
possible).

Aaron Meurer

On Thu, Nov 10, 2016 at 6:22 PM, qm <[email protected]> wrote:
> Why do these identical elementary integrations lead to differing results?
> In the 1st version the parameters y,G are kept arbitrary before doing the
> integration.
> In the 2nd version the parameters are set before the integration.
> The integrand is completely harmless, both with respect to the variable and
> the parameters.
> The results differ. Why?
>
> x,y,G=sp.symbols('x y G')
>
> c = lambda x: G/(x**2+G**2)
>
> u=sp.integrate(c(x)*c(x-y),x)
>
> d = (c(x)*c(x-y)).subs({y:sp.Integer(2),G:sp.Integer(1)})
>
> v=sp.integrate(d,x)
>
>
> print (u.subs({x:sp.Integer(1),y:sp.Integer(2),G:sp.Integer(1)})).evalf()
>
> print (v.subs({x:sp.Integer(1)})).evalf()
>
>
> -0.392699081698724 + 0.e-21*I
>
> 0
>
>
>
> --
> 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 https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/ef11d5e4-a7c2-434c-b9c9-8236bec34468%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6JLGewKhExxwg8xf6nTqvLJJMHmmBVAdAsGyekHx%3DvfAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to