grzegorzmazur / yacas

Computer calculations made easy
http://www.yacas.org
GNU Lesser General Public License v2.1
126 stars 24 forks source link

Integrate an expression with a parameter? #341

Open doronbehar opened 2 years ago

doronbehar commented 2 years ago

Why does this not work:

In> Integrate(x) 1/(x^2+a^2)
CommandLine(1) : "Gcd: argument is not an exact number"
Out> False

Do I need to declare a? Derivation for such an expression does work:

In> D(x) 1/(x^2+a^2)
Out> (-2*x)/(x^2+a^2)^2
grzegorzmazur commented 2 years ago

Hi,

1/(x^2 + a^2) is a very simple rational function, which integrates to 1/a * arctan(x/a) + c for non-zero, real a. The problem is that it's treated as a general rational function, where presence of parameter(s) makes things quite difficult. The error you get is from the general algorithm for integrating rational functions. I'll try to add some code to integrate well known special cases like this before the general method is attempted.