"D", "diff" derivative conversion and _maxima_init_ bug

4 views
Skip to first unread message

Golam Mortuza Hossain

unread,
Jul 2, 2009, 7:15:07 PM7/2/09
to sage-...@googlegroups.com
Hi all,

I have been looking into this critical bug

http://trac.sagemath.org/sage_trac/ticket/6376

(This bug affects me badly and in fact I need to use sage-3.4 for
my own work to avoid this)

This bug is related with "D" <-> "diff" conversion for symbolic
functions.

Following are my observations and a proposal to deal with this bug.

[o] D <-> diff conversion is NOT one-to-one

Ex: (A) diff( f(x-a), x) => D[0] f(x-a)
(B) D[0](f)(x-a ) => (i) diff( f(x-a), x)
(ii) - diff( f(x-a), a)
So conversion is tricky.


Here are my proposals to deal with this:

(1) Keep current conversion when arguments are all symbolic variables.
This way solving differential eqn and others will work as usual
via maxima.

(2) Do not convert D to diff format when an argument is an expression.
In that case pass it to maxima as another symbolic function of the
form

D( f(x-a), [0] )

From maxima output, we can then convert it back to D format.

(3) Finally, let's represent (text-mode) D derivative as

D( f(x,y), [0,0,1] ) ( which is represented now as
D[0,0,1](f)(x,y) )

or optionally

D( f(x,y), [(0,2), (1,1)] )

This form has several advantages:

(i) Above is a valid form of python function and one can copy-paste
sage output from one cell to another as vaild sage input.
Currently this is not the case.

(ii) Sage output often contains terms like "D[0](f)(g(x))". However,
right now there is no way one can enter above in Sage directly.

I will be happy to implement this if we can reach consensus.


Cheers,
Golam

Robert Bradshaw

unread,
Jul 2, 2009, 11:14:14 PM7/2/09
to sage-...@googlegroups.com

I thought the consensus was that the D[n], though more powerful, was
far less intuitive and so we were going to go with "diff(f(x,y), x)"
or even "(df/dx)(x,y)" for printing.

- Robert

Golam Mortuza Hossain

unread,
Jul 3, 2009, 8:21:43 AM7/3/09
to sage-...@googlegroups.com
On Fri, Jul 3, 2009 at 12:14 AM, Robert
Bradshaw<robe...@math.washington.edu> wrote:
> I thought the consensus was that the D[n], though more powerful, was
> far less intuitive and so we were going to go with "diff(f(x,y), x)"
> or even "(df/dx)(x,y)" for printing.

No. If I gather properly, the consensus was to use D[n] :-)

In any case, given new symbolics uses D derivative internally,
we need a conversion method between these two formats.
Unfortunately, the conversion is not one-to-one.

Consequently, integral (using maxima) that used work
in sage 3.4 doesn't work anymore. For example:

-----------
sage: var('x,a'); f(x) = function('f',x)
sage: g = f(x-a).diff(x)
sage: integrate(g, x)
-----------
doesn't work in new symbolics.


Cheers,
Golam

William Stein

unread,
Jul 3, 2009, 10:01:36 AM7/3/09
to sage-...@googlegroups.com
On Fri, Jul 3, 2009 at 2:21 PM, Golam Mortuza
Hossain<gmho...@gmail.com> wrote:
>
> On Fri, Jul 3, 2009 at 12:14 AM, Robert
> Bradshaw<robe...@math.washington.edu> wrote:
>> I thought the consensus was that the D[n], though more powerful, was
>> far less intuitive and so we were going to go with "diff(f(x,y), x)"
>> or even "(df/dx)(x,y)" for printing.
>
> No. If I gather properly, the consensus was to use D[n] :-)

No it wasn't.

In case you're having trouble with your email client, I'm forwarding
my message from June 16. In response to the message below, several
messages later you called for another vote (I don't know why), which
had the same conclusion.

---------- Forwarded message ----------
From: William Stein <wst...@gmail.com>
Date: Tue, Jun 16, 2009 at 6:34 PM
Subject: Re: [sage-devel] Re: typesetting partial derivatives
To: sage-...@googlegroups.com

The vote was:

Maple style D[...] notation: 2 votes
Mathematica style exponent notation: 4 votes

So the conclusion is that we will go with the Mathematica style notation.

William

--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Golam Mortuza Hossain

unread,
Jul 3, 2009, 11:38:02 AM7/3/09
to sage-...@googlegroups.com
Hi,

On Fri, Jul 3, 2009 at 11:01 AM, William Stein<wst...@gmail.com> wrote:
>
> On Fri, Jul 3, 2009 at 2:21 PM, Golam Mortuza
> Hossain<gmho...@gmail.com> wrote:
>>
>> On Fri, Jul 3, 2009 at 12:14 AM, Robert
>> Bradshaw<robe...@math.washington.edu> wrote:
>>> I thought the consensus was that the D[n], though more powerful, was
>>> far less intuitive and so we were going to go with "diff(f(x,y), x)"
>>> or even "(df/dx)(x,y)" for printing.
>>
>> No. If I gather properly, the consensus was to use D[n] :-)
>
> No it wasn't.
>
> In case you're having trouble with your email client, I'm forwarding
> my message from June 16.  In response to the message below, several
> messages later you called for another vote (I don't know why), which
> had the same conclusion.
>

Sorry for the confusion. I guess, I mean the the same what you are saying.
The consensus was NOT to use old "diff" format output and typesetting
using "\partial".

So in this sense, I refer them as "D" format derivative where variable
of differentiation
is indicated by its position (in arguments of the function) and not by
its expression as in
"diff" format.

Hope this clarifies.


Cheers,
Golam

Reply all
Reply to author
Forward
0 new messages