Ask Your Question

davidsevilla's profile - activity

2017-12-24 10:45:32 +0200 received badge  Good Question (source)
2017-11-25 02:12:34 +0200 received badge  Nice Question (source)
2015-07-09 19:18:02 +0200 received badge  Popular Question (source)
2015-07-09 19:18:02 +0200 received badge  Notable Question (source)
2015-07-09 19:18:02 +0200 received badge  Famous Question (source)
2015-03-24 20:15:29 +0200 received badge  Famous Question (source)
2014-03-31 18:04:04 +0200 received badge  Notable Question (source)
2014-01-14 08:25:21 +0200 asked a question Bound box for parametric 3D plots?

I am trying to plot a parametric surface but only in a certain box in 3D space. Namely, I would like to get JMol to plot this:

var('s t')
p = [s^2, s^2+t^2, s^2+s*t+s+t]; q = s^2+t^2+s-t+1
parametric_plot3d((p[0]/q,p[1]/q,p[2]/q),(s,-5,5),(t,-5,5), points=[100,100])

but restricted to [0,1]x[0,1]x[0,1] (for example). I see that implicit plots work exactly like that, but the singular part of this surface looks quite ugly: http://imgur.com/5IxilIz.

I would be fine with tachyon too, but I haven't been able to figure out how to rotate the camera (I basically want to cut out a chunk of that surface to see a section).

2014-01-14 08:09:44 +0200 received badge  Supporter (source)
2014-01-14 08:09:35 +0200 received badge  Scholar (source)
2014-01-14 08:09:35 +0200 marked best answer Partial fraction decomposition over the reals or complex

Expanding on Snark's comment: use algebraic numbers to get an exact answer.

Algebraic numbers can be explored, you can ask their minimal polynomial or a radical expression.

sage: R.<x> = QQbar['x']
sage: ff = x^3 - 2
sage: factor(ff)
(x - 1.259921049894873?) * (x + 0.6299605249474365? - 1.091123635971722?*I) * (x + 0.6299605249474365? + 1.091123635971722?*I)
sage: (1/ff).partial_fraction_decomposition()
(0,
 [(0.2099868416491456? + 0.?e-19*I)/(x - 1.259921049894873?),
  (-0.10499342082457277? + 0.1818539393286203?*I)/(x + 0.6299605249474365? - 1.091123635971722?*I),
  (-0.10499342082457277? - 0.1818539393286203?*I)/(x + 0.6299605249474365? + 1.091123635971722?*I)])

The entries are exact; they live in QQbar. To investigate the entries:

sage: for q in factor(ff):
....:     q = q[0]
....:     print 'x - a =', q
....:     a = QQbar(x - q)
....:     print '  a =', a
....:     print '  minpoly:', a.minpoly()
....:     print '  radical:', a.radical_expression()
....:     
x - a = x - 1.259921049894873?
  a = 1.259921049894873?
  minpoly: x^3 - 2
  radical: 2^(1/3)
x - a = x + 0.6299605249474365? - 1.091123635971722?*I
  a = -0.6299605249474365? + 1.091123635971722?*I
  minpoly: x^3 - 2
  radical: 1/2*I*sqrt(3)*2^(1/3) - 1/2*2^(1/3)
x - a = x + 0.6299605249474365? + 1.091123635971722?*I
  a = -0.6299605249474365? - 1.091123635971722?*I
  minpoly: x^3 - 2
  radical: -1/2*I*sqrt(3)*2^(1/3) - 1/2*2^(1/3)

and

sage: for q in (1/ff).partial_fraction_decomposition()[1]:
....:     print 'a / (x - b) =', q
....:     a = QQbar(q.numerator())
....:     print '  a =', a
....:     print '  minpoly:', a.minpoly()
....:     print '  radical:', a.radical_expression()
....:     b = QQbar(x - q.denominator())
....:     print '  b =', b
....:     print '  minpoly:', b.minpoly()
....:     print '  radical:', b.radical_expression()
....: 
a / (x - b) = 0.2099868416491456?/(x - 1.259921049894873?)
  a = 0.2099868416491456?
  minpoly: x^3 - 1/108
  radical: 1/12*4^(2/3)
  b = 1.259921049894873?
  minpoly: x^3 - 2
  radical: 2^(1/3)
a / (x - b) = (-0.10499342082457277? + 0.1818539393286203?*I)/(x + 0.6299605249474365? - 1.091123635971722?*I)
  a = -0.10499342082457277? + 0.1818539393286203?*I
  minpoly: x^3 - 1/108
  radical: 1/24*4^(2/3)*(I*sqrt(3) - 1)
  b = -0.6299605249474365? + 1.091123635971722?*I
  minpoly: x^3 - 2
  radical: 1/2*I*sqrt(3)*2^(1/3) - 1/2*2^(1/3)
a / (x - b) = (-0.10499342082457277? - 0.1818539393286203?*I)/(x + 0.6299605249474365? + 1.091123635971722?*I)
  a = -0.10499342082457277? - 0.1818539393286203?*I
  minpoly: x^3 - 1/108
  radical: 1/24*4^(2/3)*(-I*sqrt(3) - 1)
  b = -0.6299605249474365? - 1.091123635971722?*I
  minpoly: x^3 - 2
  radical: -1/2*I*sqrt(3)*2^(1/3) - 1/2*2^(1/3)
2013-09-21 22:08:01 +0200 received badge  Popular Question (source)
2012-11-20 17:10:21 +0200 received badge  Student (source)
2012-11-20 15:29:04 +0200 asked a question Partial fraction decomposition over the reals or complex

Hi,

I am trying to get partial fraction decomposition (for integration) but over the complex numbers. For example, the denominator (x^2+1)*(x^3-2) should produce five fractions. I have experimented a bit with coercion but didn't manage to get anything. For example:

f=x^3-2
R=CC['x']
ff=R(f)
factor(f); factor(ff)

produces

x^3 - 2
(x - 1.25992104989487) * (x + 0.629960524947437 - 1.09112363597172*I) * (x + 0.629960524947437 + 1.09112363597172*I)

so far so good (except for decimals). But (1/f).partial_fraction() produces 1/(x^3 - 2), and (1/ff).partial_fraction() produces

Traceback (click to the left of this block for traceback)
...
AttributeError: 'FractionFieldElement_1poly_field' object has no attribute 'partial_fraction'

On the other hand, (1/ff).partial_fraction_decomposition() gives

(0, [0.209986841649145/(x - 1.25992104989487), (-0.104993420824573 +
0.181853939328620*I)/(x + 0.629960524947437 - 1.09112363597172*I),
(-0.104993420824573 - 0.181853939328620*I)/(x + 0.629960524947437 +
1.09112363597172*I)])

which is correct but not exact. Is there a command to get an exact decomposition over C, or am I stuck with having to set and solve a linear system?

Thanks