Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

integral not simplifying

hello, can anyone please explain why the first integral works but the second doesnt ? even thought that they are both the same (only minus in different places):

sage: x = var('x')
sage: integrate(-(x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1), x)
-integrate((x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1), x)
sage: -integrate((x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1), x)
1/sqrt((x - 1)^2 + 1)

and how can i make so that the first integral would get simplified automatically?

integral not simplifying

hello, can anyone please explain why the first integral works but the second doesnt ? doesnt? even thought that they are both the same (only minus in different places):

sage: x = var('x')
sage: integrate(-(x f = -(x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1)
sage: integrate(f, x)
-integrate((x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1), x)
-integrate((x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1), x)
sage: -integrate((x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1), sage: f = (x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1)
sage: -integrate(f, x)
1/sqrt((x - 1)^2 + 1)

and only full simplify somehow helps:

sage: f = -(x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1)
sage: f.simplify()
-(x - 1)*((x - 1)^2/((x - 1)^2 + 1)^2 + 1/((x - 1)^2 + 1)^2)/sqrt((x - 1)^2 + 1)
sage: f.full_simplify()
-(x - 1)/(x^2 - 2*x + 2)^(3/2)
sage: integrate(f.full_simplify(), x)
1/sqrt(x^2 - 2*x + 2)

so basically the answer is to do full simplify, but i cant do full simplify on a vector (my original problem is to do this integral on vector):

sage: v = vector([x , 1 , 2])
sage: v.full_simplify()
... 'FreeModule_ambient_field_with_category.element_class' object has no attribute 'full_simplify'

so how can i make so that the first integral would get simplified automatically?avoid sagemath from returning me the "integrate(...)" thing and just do the integral?