On Sun, 19 Apr 2009 10:34:21 -0700
Carl Witty <carl.wi...@gmail.com> wrote:

> 
> On Sun, Apr 19, 2009 at 7:44 AM, Maurizio
> <maurizio.gran...@gmail.com> wrote:
> > Carl, I took advantage of your suggestion, even though I assume I
> > can't still go through the whole process with the current gcd
> > capabilities in Pynac. But before than that, I'd like to point out
> > something strange I did notice, and maybe also Burcin can help with
> > that:
> >
> > reset()
> > P.<x,z> = QQ[]
> >
> > B = x^3 + x
> >
> > var('x, zs', ns = 1)
> > from sage.symbolic.ring import NSR
> > Bs = NSR(B)
> > Bs
> >     x^3 + x
> > Bs.diff(x)
> >     0
> >
> > So, the derivative is not working. Which is the cause? It seems that
> > the "x" in Bs is not the "x" I declared, so the derivative gets 0
> > as a result. Which is the reason?
> 
> Looks like  a bug to me.
> 
> Burcin, any comments?

I agree that it's confusing, but it's not a bug.

The command

sage: Bs = NSR(B)

converts the polynomial B = x^3 + x in QQ[x] to a symbolic expression,
with one numeric coefficient, namely B.

sage: Bs.coeff(x)
0
sage: Bs.is_constant()
True
sage: Bs.pyobject()
x^3 + x
sage: Bs.pyobject().parent()
Multivariate Polynomial Ring in x, z over Rational Field

Since Bs is a constant w.r.t. the symbolic x, the derivative of Bs
w.r.t. the symbolic variable x is 0. 


In order to convert the polynomial to a symbolic expression, I suggest
substituting the symbolic variables in the polynomial.

sage: B.subs(x=x)
x^3 + x
sage: t = B.subs(x=x)
sage: t.coeff(x)
1
sage: t.coeff(x^3)
1
sage: t.derivative(x)
3*x^2 + 1

<snip>
> A good integration algorithm probably has a couple of phases -- first
> you try some heuristics, and pattern-match against a database of known
> integrals; if those fail, then you bring out the big guns and apply
> the decision procedure.  If you're interested in working on
> integration, maybe you'd rather work on the first phase?  That
> probably requires more computer science and less math than the second
> phase.


Indeed, this was what I tried to say in those comments about
integration that got Maurizio started on this track.

There are descriptions of heuristics we can use in the maxima manual [1]
and the book by Geddes, Czapor and Labahn [2].

[1]
http://maxima.sourceforge.net/docs/manual/en/maxima_20.html#Item_003a-integrate

[2] http://books.google.at/books?id=9fOUwkkRxT4C&pg=PR2&hl=en#PPA473,M1

It would be great if someone went through these links, and made them
more explicit/precise. As I said before, implementing these should be
within reach with the pattern matching/rewriting capabilities of pynac.


Here is an example, pointed out to me by Clemens Raab, which maxima can
do and MMA can't:

sage: g=log(1-x)/(polylog(2,x)^2+log(1-x)*polylog(3,x))
sage: f = g.derivative(x)
sage: integral(f,x)
log(1 - x)/(log(1 - x)*polylog(3, x) + polylog(2, x)^2)


Cheers,
Burcin

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to