Ask Your Question

Oscar de Lama's profile - activity

2023-07-04 19:04:09 +0100 received badge  Popular Question (source)
2021-01-03 04:14:10 +0100 commented answer Simplify expression with root

Great! Thanks a lot!

2021-01-03 04:13:48 +0100 commented answer Integrate() Error

Great! Thanks a lot!

2020-12-25 01:02:18 +0100 received badge  Student (source)
2020-12-25 00:59:40 +0100 asked a question Integrate() Error

For: SageMath version 9.0, Release Date: 2020-01-01 When integrating this:

t = var('t'); f(t) = (sin(2*t)*sin(t))/(cos(t)+3)
a_2 = integrate(f, t, 0, pi)*2/(2*pi)
a_2

Output:

-17

I get -17 ?!

If I just replace sin(2t) with its identity 2sin(t)*cos(t), and integrate again:

t = var('t'); f(t) = (2*sin(t)*cos(t)*sin(t))/(cos(t)+3)
a_2 = integrate(f, t, 0, pi)*2/(2*pi)
a_2

Output:

   -(470832*sqrt(2) - 665857)/(13860*sqrt(2) - 19601)

This last value is the correct one. Simplifying this expression (which I don't know how to do in Sage), you have:

(12*sqrt(2)-17)

It seems like the first result, wrongly reporting -17, somehow is missing the 12*sqrt(2) part of it.

2020-12-25 00:59:40 +0100 asked a question Simplify expression with root

The result of some integral, computed using integrate(), is:

2*(2378*sqrt(2) - 3363)/(408*sqrt(2) - 577)

However, when I do the integral "by hand" I get

2*(3-2*sqrt(2))

Numerically both results are the same, but the first result is a lot more complicated.

Multiplying separately the numerator and denominator of the first expression by (408*sqrt(2) + 577) brings the correct result.

What can I do to simplify the first expression and get something really simple, as the second one?

Thanks in advance!