Ask Your Question
1

unable to simplify to float approximation with a gamma function

asked 2016-12-07 09:29:03 +0200

anonymous user

Anonymous

I'm very new to Sage, so please forgive me if this is a trivial question. I've been trying to specify a function as follows:

p(x,a,b) =  x * math.gamma(a + b)

However, I get the following error message:

TypeError: unable to simplify to float approximation

How do I specify the function p() that contains a Gamma function? I was thinking I could create a Python function (i.e. starting with def(x,a,b)) and then put the code inside the function body, but I have a feeling I'm missing something.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-12-07 16:32:59 +0200

slelievre gravatar image

No need to use math.gamma, you can just use gamma.

This works for me.

sage: p(x,a,b) =  x * gamma(a + b)
sage: p(2,3,4)
1440
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: 2016-12-07 09:29:03 +0200

Seen: 179 times

Last updated: Dec 07 '16