Ask Your Question
1

what instance is integral from?

asked 2018-08-03 05:26:05 +0100

Nasser gravatar image

updated 2018-08-03 22:40:11 +0100

eric_g gravatar image

When the result has integrate in it, I check for it as follows

sage: anti=integrate(1/(sqrt(x + 1)*sqrt(-x + 1) + 5), x) 
     integrate(1/(sqrt(x + 1)*sqrt(-x + 1) + 5), x)

sage: isinstance(anti.operator(), sage.symbolic.integration.integral.IndefiniteIntegral)
True

But the above does not work when the result is integral instead of integrate.

My question is, what instance is integral coming from?

sage: anti=integrate(cos(b*x + a)*cos_integral(d*x + c)/x,x, algorithm="fricas")
        integral(cos(b*x + a)*cos_integral(d*x + c)/x, x)
sage: anti.operator()
        integral
sage: isinstance(anti.operator(), sage.symbolic.integration.integral.IndefiniteIntegral)
         False

I looked at http://doc.sagemath.org/html/en/refer... but still do not know how to check for intergal vs. integrate

Any suggestions? thanks --Nasser

edit retag flag offensive close merge delete

Comments

1

Have you tried type(anti.operator()) for the integral case?

eric_g gravatar imageeric_g ( 2018-08-03 09:25:23 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-08-03 22:37:56 +0100

eric_g gravatar image

We have

sage: var('a b c d')
(a, b, c, d)
sage: anti = integrate(cos(b*x + a)*cos_integral(d*x + c)/x, x, algorithm="fricas")
sage: anti
integral(cos(b*x + a)*cos_integral(d*x + c)/x, x)
sage: anti.operator()
integral
sage: type(anti.operator())
<class 'sage.symbolic.function_factory.NewSymbolicFunction'>

So, integral in anti is a NewSymbolicFunction. I would say this reflects a bad conversion of the FriCAS integral to a SageMath integral. Indeed, the derivative treats integral as an ordinary (generic) function, not as an antiderivative, as you can see from the D[0](integral) and D[1](integral) below:

sage: diff(anti, x)
-(b*cos_integral(d*x + c)*sin(b*x + a)/x - d*cos(b*x + a)*cos(d*x + c)/((d*x + c)*x) + cos(b*x + a)*cos_integral(d*x + c)/x^2)*D[0](integral)(cos(b*x + a)*cos_integral(d*x + c)/x, x) + D[1](integral)(cos(b*x + a)*cos_integral(d*x + c)/x, x)

As a workaround, you can substitute the fake integral by the true SageMath integral:

sage: anti2 = anti.substitute_function(anti.operator(), integrate)
sage: anti2
integrate(cos(b*x + a)*cos_integral(d*x + c)/x, x)
sage: diff(anti2, x)
cos(b*x + a)*cos_integral(d*x + c)/x
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: 2018-08-03 05:26:05 +0100

Seen: 358 times

Last updated: Aug 03 '18