Ask Your Question
1

How to use algorithm='mathematica free' to calculate definite integral?

asked 2013-06-17 08:46:01 -0600

IvanG gravatar image

updated 2015-01-14 03:31:17 -0600

FrédéricC gravatar image

Is it possible to use algorithm='mathematica free' to calculate definite integral ?

integrate(x^2,x,algorithm='mathematica_free')

Output:

1/3*x^3

and

integrate(x^2,x,0,1,algorithm='mathematica_free')

Output:

1/3*x^3

but I want 1/3

edit retag flag offensive close merge delete

Comments

1

Looks like mathematica_free only calculates indefinite integrals. http://integrals.wolfram.com ... so Sage would need to apply the limits after receiving the indefinite result. As a work-around you could define a function that passes the integrand to mathematica_free and then performs the difference after applying the variable limits.

rickhg12hs gravatar imagerickhg12hs ( 2013-06-17 15:38:06 -0600 )edit
1

If Sage wanted to calculate the definite integral as described in my previous comment,a simple change to sage/symbolic/integration/external.py could accomplish this. One wonders what would happen with wacky input/output though.

rickhg12hs gravatar imagerickhg12hs ( 2013-06-17 15:58:44 -0600 )edit

Thanks for comments!

IvanG gravatar imageIvanG ( 2013-06-17 17:49:45 -0600 )edit
2
kcrisman gravatar imagekcrisman ( 2013-06-17 18:50:54 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2013-06-17 17:49:19 -0600

IvanG gravatar image

Thanks for comments!

x=var('x')
f = lambda x : x^2
def defintegral_viaMathFree(f,x,a,b):
F(x)=integrate(f(x),x,algorithm='mathematica_free')
return F(b)-F(a)

And

defintegral_viaMathFree(f,x,0,1)

output: 1/3

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

Stats

Asked: 2013-06-17 08:46:01 -0600

Seen: 401 times

Last updated: Jun 17 '13