First time here? Check out the FAQ!

Ask Your Question
1

unable to simplify to float approximation with a gamma function

asked 8 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 8 years ago

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
Preview: (hide)
link

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: 8 years ago

Seen: 2,050 times

Last updated: Dec 07 '16