The good thing is that Sage supports algebraic numbers as coefficients in
the symbolic ring. So we can construct the expression:
RootSum(229*_t**4 + 6*_t**2 + _t + 1, Lambda(_t, _t*log(-37785*_t**3/3547 -
5496*_t**2/3547 + 12979*_t/3547 + x + 691/3547)))
like this:
sage: R.<t> = QQ[]
sage: f = 229*t**4 + 6*t**2 + t + 1
sage: r = f.roots(QQbar,multiplicities=False)
sage: s = sum( [_t*log(-37785*_t**3/3547 - 5496*_t**2/3547 + 12979*_t/3547
+ x+691/3547) for _t in map(SR,r)])
sage: s
(0.1632770936766041? + 0.2155134438686071?*I)*log(x + 1.018912794385156? +
0.6025654199985990?*I) + (0.1632770936766041? -
0.2155134438686071?*I)*log(x + 1.018912794385156? - 0.6025654199985990?*I)
- (0.1632770936766041? - 0.1818616163826090?*I)*log(x - 0.5189127943851559?
+ 0.6666098449320185?*I) - (0.1632770936766041? +
0.1818616163826090?*I)*log(x - 0.5189127943851559? - 0.6666098449320185?*I)
The bad news is that these expressions have no maxima or sympy counterpart,
so only the symple symbolic manipulation is possible:
sage: sd=s.derivative()
sage: sd
(0.1632770936766041? + 0.2155134438686071?*I)/(x + 1.018912794385156? +
0.6025654199985990?*I) + (0.1632770936766041? - 0.2155134438686071?*I)/(x +
1.018912794385156? - 0.6025654199985990?*I) - (0.1632770936766041? -
0.1818616163826090?*I)/(x - 0.5189127943851559? + 0.6666098449320185?*I) -
(0.1632770936766041? + 0.1818616163826090?*I)/(x - 0.5189127943851559? -
0.6666098449320185?*I)
sage: sd.factor()
ValueError Traceback (most recent call last)
...
--> 690 raise ValueError("Cannot coerce algebraic number
with non-zero imaginary part to algebraic real")
691 elif hasattr(x, '_algebraic_'):
692 return x._algebraic_(AA)
ValueError: Cannot coerce algebraic number with non-zero imaginary part to
algebraic real
But if we manage to do the manipulations manually, we can check that the
integral is correct:
sage: denominators=[a.operands()[0].operands()[0] for a in sd.operands()]
sage: numerators=[a.operands()[1] for a in sd.operands()]
sage: numerators
[0.1632770936766041? + 0.2155134438686071?*I,
0.1632770936766041? - 0.2155134438686071?*I,
-0.1632770936766041? + 0.1818616163826090?*I,
-0.1632770936766041? - 0.1818616163826090?*I]
sage: denominators
[x + 1.018912794385156? + 0.6025654199985990?*I,
x + 1.018912794385156? - 0.6025654199985990?*I,
x - 0.5189127943851559? + 0.6666098449320185?*I,
x - 0.5189127943851559? - 0.6666098449320185?*I]
sage: prod(denominators).expand()
x^4 + x^3 + 1.000000000000000? + 0.?e-36*I
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.