Opened 12 years ago

Closed 9 years ago

#8499 closed enhancement (fixed)

improve documentation of partial_fraction_decomposition

Reported by: zimmerma Owned by: burcin
Priority: major Milestone: sage-6.2
Component: calculus Keywords:
Cc: Merged in:
Authors: Luis Felipe Tabera Alonso Reviewers: Luis Felipe Tabera Alonso, Paul Zimmermann
Report Upstream: N/A Work issues:
Branch: u/lftabera/8499_doc_fracdec (Commits, GitHub, GitLab) Commit: d7b561af265afe6df74f292b6cc50e8bec2d6fe3
Dependencies: Stopgaps:

Status badges

Description (last modified by zimmerma)

How can one compute a partial fraction decomposition over the complex numbers? Consider the following:

sage: x = PolynomialRing(RationalField(), 'x').gen()
sage: r = 1 /(x^4 + 1)
sage: r.partial_fraction_decomposition()
(0, [1/(x^4 + 1)])

This is ok since we explicitely work over QQ. Now compare with:

sage: P.<y> = PolynomialRing(RationalField())
sage: Qbar.<y> = QuotientRing(P, y^2+1)
sage: x = PolynomialRing(Qbar, 'x').gen()
sage: r = 1 /(x^4 + 1)
sage: r.partial_fraction_decomposition()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)

apply trac_8499.patch

Attachments (1)

trac_8499.patch (2.0 KB) - added by zimmerma 9 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:2 Changed 9 years ago by zimmerma

I found out the solution by myself. If one wants say a decomposition over Q[sqrt(2)] or Q[I], then simply use QQ[sqrt(2)] or QQ[sqrt(-1)]:

sage: R.<x> = QQ[sqrt(2)][]
sage: r=1/(x^4+1)
sage: r.partial_fraction_decomposition()
(0,
 [(-1/4*sqrt2*x + 1/2)/(x^2 - sqrt2*x + 1),
  (1/4*sqrt2*x + 1/2)/(x^2 + sqrt2*x + 1)])

or:

sage: R.<x> = QQ[sqrt(-1)][]            
sage: r=1/(x^4+1)                       
sage: r.partial_fraction_decomposition()
(0, [(-1/2*I)/(x^2 - I), 1/2*I/(x^2 + I)])

Now if you want Sage to automatically find the extension where the denominator fully factors, use QQbar:

sage: R.<x> = QQbar[]                   
sage: r=1/(x^4+1)                       
sage: r.partial_fraction_decomposition()
(0,
 [([-0.17677669529663690 .. -0.17677669529663686] - [0.17677669529663686 .. 0.17677669529663690]*I)/(x + [-0.70710678118654758 .. -0.70710678118654746] - [0.70710678118654746 .. 0.70710678118654758]*I),
  ([-0.17677669529663690 .. -0.17677669529663686] + [0.17677669529663686 .. 0.17677669529663690]*I)/(x + [-0.70710678118654758 .. -0.70710678118654746] + [0.70710678118654746 .. 0.70710678118654758]*I),
  ([0.17677669529663686 .. 0.17677669529663690] - [0.17677669529663686 .. 0.17677669529663690]*I)/(x + [0.70710678118654746 .. 0.70710678118654758] - [0.70710678118654746 .. 0.70710678118654758]*I),
  ([0.17677669529663686 .. 0.17677669529663690] + [0.17677669529663686 .. 0.17677669529663690]*I)/(x + [0.70710678118654746 .. 0.70710678118654758] + [0.70710678118654746 .. 0.70710678118654758]*I)])

I'll add some examples to the documentation and then we can close this ticket.

Paul

Changed 9 years ago by zimmerma

comment:3 Changed 9 years ago by zimmerma

  • Authors set to Paul Zimmermann
  • Description modified (diff)
  • Status changed from new to needs_review
  • Summary changed from partial_fraction_decomposition does not work over algebraic extensions to improve documentation of partial_fraction_decomposition

I've changed the ticket summary, and attached a patch (against Sage 5.9) which improves the documentation of partial_fraction_decomposition.

Paul

comment:4 Changed 9 years ago by zimmerma

  • Type changed from defect to enhancement

comment:5 Changed 9 years ago by lftabera

  • Status changed from needs_review to needs_info

Looks good, but I have a question. How is computing the rational fraction decomposition over QQbar gives you the extension where the denominator splits? It just returns the full decomposition over QQbar no more no less. The extension would be in any case the splitting field of the denominator, isn't it?

I would expect something like "Now if you want Sage to compute an extension where the denominator fully factors, use QQbar: "

comment:6 Changed 9 years ago by zimmerma

thank you for your feedback. You have two questions in fact:

How is computing the rational fraction decomposition over QQbar gives you the extension where the denominator splits?

this is given in the denominators of the output.

The extension would be in any case the splitting field of the denominator, isn't it?

yes.

Feel free to propose a reviewer patch!

Paul

comment:7 Changed 9 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:8 Changed 9 years ago by lftabera

  • Branch set to u/lftabera/8499_doc_fracdec
  • Commit set to d7b561af265afe6df74f292b6cc50e8bec2d6fe3
  • Reviewers set to Luis Felipe Tabera Alonso
  • Status changed from needs_info to needs_review

My complain is that using QQbar does not give you the splitting field of the denominator in an obvious way. I have changed the documentation accordingly. Paul, could you take a look at my changes and check if you agree with them?

Luis

comment:9 Changed 9 years ago by zimmerma

I get an error when I try this example:

sage: R.<x> = QQ[]
sage: r = 1/(x^4+2)
sage: N = r.denominator().splitting_field('a')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-c9d534f911a3> in <module>()
----> 1 N = r.denominator().splitting_field('a')

/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.Element.__getattr__ (sage/structure/element.c:3873)()

/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/misc.so in sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1696)()

AttributeError: 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint' object has no attribute 'splitting_field'

comment:10 Changed 9 years ago by lftabera

Sorry for not telling, you need sage 6.1 released today...

comment:11 Changed 9 years ago by zimmerma

  • Authors changed from Paul Zimmermann to Luis Felipe Tabera Alonso
  • Reviewers changed from Luis Felipe Tabera Alonso to Luis Felipe Tabera Alonso, Paul Zimmermann
  • Status changed from needs_review to positive_review

I tried the added examples with Sage 6.1 and they work, thus positive review for me.

comment:12 Changed 9 years ago by vbraun

  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.