Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
0

A combination of commands partial_fraction(x) and coefficient(x,n)

asked 11 years ago

k1 gravatar image

I have asked this question over here but I got no answer.

I am trying to do some iterative calculations where each time SAGE constructs a fraction and lists the coefficients in the partial fraction decomposition of that fraction. I realized that doing everything symbolically, SAGE wants to keep everything as integer as possible. So what it does is to simplify fractions like 1/(x-3/2) as 2/(2x-3) and then when I ask for

f.coefficient(x-3/2,-1)

it returns 0, while I expect it to return 1.

I have tried to solve things numerically, but there are two problems:

  1. The errors get really big after each iteration
  2. It takes much much longer to calculate it

Any suggestions to get SAGE to solve this is greatly appreciated.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 11 years ago

ppurka gravatar image

You can do something like this

sage: f = 1/(x-3/2)
sage: g = f.denominator()
sage: f.coeff(f.denominator(), -1) / g.leading_coeff(x)
1
Preview: (hide)
link

Comments

Thanks, but the problem is that after partial fraction decomposition I have a bunch of fractions added to each other.

k1 gravatar imagek1 ( 11 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 11 years ago

Seen: 464 times

Last updated: Apr 13 '13