Ask Your Question
0

Sage vs. Mathematica. Which on believe?

asked 2016-04-21 13:20:41 +0100

RRP gravatar image

updated 2016-04-21 16:10:33 +0100

calc314 gravatar image

In Phd thesis, I'm having some trouble to calculating some tricky integrals, Sage and Mathematica show different results. To understand what goes I have calculated a simple integral.

At Sage:

var('y')
assume(y>0)
integral(log(sqrt(x^2+y^2),10),x,-10,-1)

Result: -1/2(2yarctan(10/y) - 2yarctan(1/y) + 10log(y^2 + 100) - log(y^2 +1) - 18)/log(10)

At Mathematica:

Assuming[y > 0, Integrate[log10 (Sqrt[x ^2 + y^2]), {x, -10, -1}]]

Result: 1/2 log10 (-Sqrt[1 + y^2] + 10 Sqrt[100 + y^2] + y^2 Log[(10 + Sqrt[100 + y^2])/(1 + Sqrt[1 + y^2])])

If we plot the results the output in the interval (y,-8,8), the plots will be very different. I'm making any mistake? Why this happens? Which one should I believe?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-04-21 22:53:04 +0100

Your Mathematica input is slightly off. Here's what you want:

Assuming[y > 0, Integrate[Log[10, Sqrt[x^2 + y^2]], {x, -10, -1}]]

This gives an answer with the same absolute value as Sage, but the latter returns an odd extra minus sign. You'll get the same answer for both if you change the variable of integration:

integral(log(sqrt(x^2+y^2),10),x,1,10)

edit flag offensive delete link more
0

answered 2016-04-22 17:21:43 +0100

RRP gravatar image

Thanks, I really didn't realize about that difference between "log" and "Log" since mathematica keep producing results.

The minus sign in Sage is really very weird.

Thanks.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-04-21 13:20:41 +0100

Seen: 759 times

Last updated: Apr 22 '16