Ask Your Question

Revision history [back]

You should do f12.partial_fraction() as opposed to f12(x).partial_fraction()

sage: x, k=var('x','k'); f1=1; f2=k^2 - x^2; f12=f1/f2                          
sage: f12                                                                       
1/(k^2 - x^2)
sage: f12.partial_fraction()                                                    
-1/2/((k + x)*x) + 1/2/((k - x)*x)

This raises an error:

sage: f12(x)                                                                    
Traceback (most recent call last):
...
ValueError: power::eval(): division by zero

Note that this works too (maybe this is what you intended?):

sage: f12(x,k)                                                                  
-1/(k^2 - x^2)
sage: f12(x,k).partial_fraction()                                               
1/2/((k + x)*x) - 1/2/((k - x)*x)

You should do f12.partial_fraction() as opposed to f12(x).partial_fraction()

sage: x, k=var('x','k'); f1=1; f2=k^2 - x^2; f12=f1/f2                          
sage: f12                                                                       
1/(k^2 - x^2)
sage: f12.partial_fraction()                                                    
-1/2/((k + x)*x) + 1/2/((k - x)*x)

This raises an error:the error you mention:

sage: f12(x)                                                                    
Traceback (most recent call last):
...
ValueError: power::eval(): division by zero

Note that this works too (maybe this is what you intended?):

sage: f12(x,k)                                                                  
-1/(k^2 - x^2)
sage: f12(x,k).partial_fraction()                                               
1/2/((k + x)*x) - 1/2/((k - x)*x)