Algebrite icon indicating copy to clipboard operation
Algebrite copied to clipboard

integral(x^2/(a+b*x)) wrong

Open murkle opened this issue 8 years ago • 4 comments

Algebrite.run("integral(x^2/(a+b*x))")
"-a x / b + 1/2 x^2 - 3 a^2 / (2 b^2) + a^2 log(b x + a) / (b^2)"

A possible correct answer (from GeoGebra) is (((1 / 2 * b) * x^(2)) - (a * x)) / b^(2) + (a^(2) * log(abs((b * x) + a)) / b^(3)) which differentiates to the correct expression (also has log(abs()))

Algebrites answer has an extra factor of b when differentiated (b * x^(2) / (a + (b * x))) http://www.wolframalpha.com/input/?i=derivative+of+-a+x+%2F+b+%2B+1%2F2+x%5E2+-+3+a%5E2+%2F+(2+b%5E2)+%2B+a%5E2+log(b+x+%2B+a)+%2F+(b%5E2)

(bug found by running list of Algebrite's standard integrals through GeoGebra/Giac and comparing, I can share the script once I've debugged it a bit :smile: )

murkle avatar May 24 '16 18:05 murkle

This mostly works (look in the console for the output) http://test.geogebra.org/~mike/algebrite/algebriteIntegralTests.html

It checks the outputs by comparing this to zero: Simplify[Derivative[ ans1 - (ans2)]]

Problems:

  • it runs out of memory after ~62 tests
  • comparing outputs automatically with sqrt() in is hard
  • some Algebrite answers have (-1)^(1/3) in, also GeoGebra/Giac has trouble too, eg
Algebrite input = integral(1/(9+(-25)*x^3))
Algebrite output = -(-1)^(1/3) arctan(2 (-1)^(2/3) 5^(2/3) x / (3 3^(1/6)) + 3^(-1/2)) / (3 3^(5/6) 5^(2/3)) + (-1)^(1/3) log(-9 / (25 (-25 x^3 + 9)) + 3 (-1)^(1/3) 3^(2/3) x^2 / (5^(2/3) (-25 x^3 + 9)) + 9 (-1)^(2/3) 3^(1/3) x / (5 5^(1/3) (-25 x^3 + 9)) + x^3 / (-25 x^3 + 9)) / (18 3^(1/3) 5^(2/3))
js giac  input:evalfa(regroup(integrate((1)/((9)+((-(25))*((x)^(3)))),x)))
js giac output:0.04563496237392*atan((x+1/2*(9/25)^(1/3))*2/sqrt(3)/(9/25)^(1/3))-1/27*(9/25)^(1/3)*ln(abs(x-(9/25)^(1/3)))+45^(1/3)/270*ln(x^2+((9/25)^(1/3))^2+(9/25)^(1/3)*x)+c_138

murkle avatar May 24 '16 20:05 murkle

These could maybe be improved to give a real output:

algebriteIntegralTests.html:72 Algebrite input = integral(log((-9)*x))
algebriteIntegralTests.html:75 Algebrite output = -x + log(9) x + x log(x) + i pi x
js giac  input:evalfa(regroup(integrate(log((-(9))*(x)),x)))
js giac output:-1/9*(-9*x*ln(-9*x)+9*x)+c_32
algebriteIntegralTests.html:72 Algebrite input = integral(1/((-9)-x^2))
algebriteIntegralTests.html:75 Algebrite output = -1/3 i arctanh(-1/3 i x)
web3d-0.js:20913 js giac  input:evalfa(regroup(integrate((1)/((-(9))-((x)^(2))),x)))
web3d-0.js:20913 js giac output:-1/3*atan(1/3*x)+c_44
algebriteIntegralTests.html:72 Algebrite input = integral(1/sqrt((-9)-x^2))
algebriteIntegralTests.html:75 Algebrite output = arcsin(-1/3 i x)
web3d-0.js:20913 js giac  input:evalfa(regroup(integrate((1)/(sqrt((-(9))-((x)^(2)))),x)))
web3d-0.js:20913 js giac output:asin(1/3*x)+c_48

murkle avatar May 24 '16 20:05 murkle

in the third one: d(arcsin(1/3*x)) is 1 / (3 (-1/9 x^2 + 1)^(1/2)) i.e. 1/sqrt(9-x^2) . Looks to me like the difference can't be ascribed by the constant C of the primitive, the two results would seem actually different - am I missing something?

davidedc avatar May 24 '16 23:05 davidedc

Sorry, didn't check carefully enough - Algebrite's answer for the 3rd one is fine!

murkle avatar May 25 '16 09:05 murkle