Ask Your Question
0

How to define an integral to not be evaluated

asked 2020-07-06 19:22:40 +0200

tomcho gravatar image

I'm trying to write the following script:

var('alpha beta x')

num = x**(alpha-1) * (1-x)**(beta-1)
denom = integral(x**(alpha-1) * (1-x)**(beta-1), x)

gammadist = num / denom

diff(gammadist, x)

So it is mich easier if the integral on denom does not get evaluated. However, I cannot find a way to do that on Sage and Sage always tries to evaluate it (without success). Is there a way to tell Sage to keep it as an integral?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-07-06 19:37:06 +0200

rburing gravatar image

updated 2020-07-06 19:45:10 +0200

See the documentation of integral:

To prevent automatic evaluation use the hold argument.

Indeed,

sage: var('alpha beta x')
sage: denom = integral(x**(alpha-1) * (1-x)**(beta-1), x, hold=True); denom
integrate(x^(alpha - 1)*(-x + 1)^(beta - 1), x)
sage: diff(denom,x)
x^(alpha - 1)*(-x + 1)^(beta - 1)
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: 2020-07-06 19:22:40 +0200

Seen: 191 times

Last updated: Jul 06 '20