The old Google Groups will be going away soon, but your browser is incompatible with the new version.
typesetting partial derivatives
 There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic. There was an error processing your request. Please try again. Standard view   View as tree
 Messages 1 - 25 of 30 Newer >

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Jun 14 2009, 3:38 pm
From: Burcin Erocal <bur...@erocal.org>
Date: Sun, 14 Jun 2009 21:38:05 +0200
Local: Sun, Jun 14 2009 3:38 pm
Subject: typesetting partial derivatives
Hi again,

There were long discussion about the typesetting of partial derivatives
in the new system, but I don't think we got to a conclusion yet. The

I agree that this is annoying and trivial to typeset better:

sage: version()
'Sage Version 4.0.1, Release Date: 2009-06-06'
sage: f = function('f')
sage: f(x).derivative(x,5)
D[0, 0, 0, 0, 0](f)(x)

However, how to typeset these is not so clear:

sage: f(x+2*y).derivative(x,2)
D[0, 0](f)(x + 2*y)
sage: f(x+2*y).derivative(y,2)
4*D[0, 0](f)(x + 2*y)

In these examples, keep in mind that we did not define what the first
argument of the function is called, so we can't just replace D[0, 0]
with d/dx.

The power of this notation is seen mainly with more than one argument:

sage: f(x+y, x-y).derivative(y)
D[0](f)(x + y, x - y) - D[1](f)(x + y, x - y)

Here is what MMA does:

In[1]:= D[F[x], x]

Out[1]= F'[x]

In[2]:= TeXForm[%]

Out[2]//TeXForm= F'(x)

In[3]:= D[F[x], x, x, x, x, x]

(5)
Out[3]= F   [x]

In[4]:= TeXForm[%]

Out[4]//TeXForm= F^{(5)}(x)

In[5]:= D[F[x+2*y], x, x]

Out[5]= F''[x + 2 y]

In[6]:= TeXForm[%]

Out[6]//TeXForm= F''(x+2 y)

In[7]:= D[F[x+2*y], y, y]

Out[7]= 4 F''[x + 2 y]

In[8]:= TeXForm[%]

Out[8]//TeXForm= 4 F''(x+2 y)

In[9]:= D[F[x+y, x-y], y]

(0,1)                  (1,0)
Out[9]= -F     [x + y, x - y] + F     [x + y, x - y]

In[10]:= TeXForm[%]

Out[10]//TeXForm= F^{(1,0)}(x+y,x-y)-F^{(0,1)}(x+y,x-y)

And Maple:

> diff(f(x),x);

d
-- f(x)
dx

> diff(f(x),x$5); 5 d --- f(x) 5 dx > diff(f(x+2*y), y$2);

(2)
4 (D   )(f)(x + 2 y)

> convert(%, diff);

/  2       \|
| d        ||
4 |---- f(t1)||
|   2      ||
\dt1       /|t1 = x + 2 y

> diff(f(x+y, x-y), y);

D[1](f)(x + y, x - y) - D[2](f)(x + y, x - y)

> convert(%, diff);

D[1](f)(x + y, x - y) - D[2](f)(x + y, x - y)

I like the way MMA handles this. It's compact and consistent. So I
suggest we change things to use the MMA convention.

Cheers,
Burcin

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 14 2009, 3:45 pm
From: John Cremona <john.crem...@gmail.com>
Date: Sun, 14 Jun 2009 20:45:11 +0100
Local: Sun, Jun 14 2009 3:45 pm
Subject: Re: [sage-devel] typesetting partial derivatives
2009/6/14 Burcin Erocal <bur...@erocal.org>:

The MMA convention seems to include as a special case a prime (') for
derivatives of functions of one variable  Is that right?  Seems good
to me.

John

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 14 2009, 4:01 pm
From: Tim Lahey <tim.la...@gmail.com>
Date: Sun, 14 Jun 2009 16:01:30 -0400
Local: Sun, Jun 14 2009 4:01 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives

On Jun 14, 2009, at 3:45 PM, John Cremona wrote:

My preference is the Maple diff way because that reduces to traditional
partial derivatives when you have f(x,y).

Cheers,

Tim.

---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 14 2009, 4:08 pm
From: Burcin Erocal <bur...@erocal.org>
Date: Sun, 14 Jun 2009 22:08:59 +0200
Local: Sun, Jun 14 2009 4:08 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives
On Sun, 14 Jun 2009 20:45:11 +0100

MMA has ' and '' as a special case:

In[1]:= D[F[x],x]

Out[1]= F'[x]

In[2]:= D[%, x]

Out[2]= F''[x]

In[3]:= D[%, x]

(3)
Out[3]= F   [x]

Thanks.

Burcin

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 14 2009, 4:19 pm
From: William Stein <wst...@gmail.com>
Date: Sun, 14 Jun 2009 22:19:57 +0200
Local: Sun, Jun 14 2009 4:19 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives

Personally, I prefer the Mathematica notation because I can actually
Sage uses and I can barely read the Maple notation either.  With the
Mathematica notation it is totally completely obvious to me what is
going on.

-- William

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 14 2009, 5:03 pm
From: Golam Mortuza Hossain <gmhoss...@gmail.com>
Date: Sun, 14 Jun 2009 18:03:59 -0300
Local: Sun, Jun 14 2009 5:03 pm
Subject: Re: [sage-devel] typesetting partial derivatives
Hi

On Sun, Jun 14, 2009 at 4:38 PM, Burcin Erocal<bur...@erocal.org> wrote:
> There were long discussion about the typesetting of partial derivatives
> in the new system, but I don't think we got to a conclusion yet.

I am afraid, we might never reach a conclusion in this regard :-)
It seems to be a classic case where we are trying to fit one size
for all.

Given the previous arguments for/against any specific scheme
for derivative typesetting and my own experience while experimenting
with sage typesetting code, I am now more inclined to follow
the strategy as outlined below.

(1) Let there be options such that one can use either typesetting
scheme by choice in run-time.

(2) By default, we follow a rather hybrid approach:

(a) If we all agree that there is no ambiguity when the particular
argument is a "symbolic variable" or "symbolic function" then
we should typeset them as those found in text-books.

Ex:
(1)  D[0,0,0] (f)(x,y)    =>  \frac{\partial^3}{\partial x^3} f(x,y)
(2)  D[0] (f)(g(x,y), h(z)) =>  \frac{\partial}{\partial
g(x,y)} f(g(x,y), h(y))

(b) I guess, the main objective for this thread is now to decided
what should be the default scheme when the argument itself is an
"expression"

Ex:  (from Burcin's mail)
(1) D[0](f)(x + y, x - y)  =>  ? [ (i) MMA-like  (ii)
Maple-like (iii) Others ]

My vote:  (ii) Maple-like

Thats my two cents.

Cheers,
Golam

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 14 2009, 5:04 pm
From: Nick Alexander <ncalexan...@gmail.com>
Date: Sun, 14 Jun 2009 14:04:29 -0700
Local: Sun, Jun 14 2009 5:04 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives

> Personally, I prefer the Mathematica notation because I can actually
> read it.  I have (serious!) trouble reading the current notation that
> Sage uses and I can barely read the Maple notation either.  With the
> Mathematica notation it is totally completely obvious to me what is
> going on.

+1

Nick

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 14 2009, 6:31 pm
From: John H Palmieri <jhpalmier...@gmail.com>
Date: Sun, 14 Jun 2009 15:31:32 -0700 (PDT)
Local: Sun, Jun 14 2009 6:31 pm
Subject: Re: typesetting partial derivatives
On Jun 14, 12:38 pm, Burcin Erocal <bur...@erocal.org> wrote:

I don't like the D[1] notation at all.  By the way, when we have a
function f of two variables, should we automatically assume that the
mixed partials are equal? Does this affect our choice of notation?
(Another notation I've seen: f_n is the derivative with respect to the
nth variable, so f_12 is (f_1)_2: if the variables are x and y, take
partial with respect to x, then y; in contrast, the other mixed
partial is f_21.)

John

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 15 2009, 6:30 am
From: William Stein <wst...@gmail.com>
Date: Mon, 15 Jun 2009 12:30:56 +0200
Local: Mon, Jun 15 2009 6:30 am
Subject: Re: [sage-devel] Re: typesetting partial derivatives
On Sun, Jun 14, 2009 at 11:03 PM, Golam Mortuza

Hossain<gmhoss...@gmail.com> wrote:

> Hi

> On Sun, Jun 14, 2009 at 4:38 PM, Burcin Erocal<bur...@erocal.org> wrote:
>> There were long discussion about the typesetting of partial derivatives
>> in the new system, but I don't think we got to a conclusion yet.

> I am afraid, we might never reach a conclusion in this regard :-)

Yes we will.  It doesn't have to be unanimous, but we will reach a conclusion.

-- William

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 16 2009, 12:34 pm
From: William Stein <wst...@gmail.com>
Date: Tue, 16 Jun 2009 18:34:19 +0200
Local: Tues, Jun 16 2009 12:34 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives

On Mon, Jun 15, 2009 at 12:30 PM, William Stein<wst...@gmail.com> wrote:
> On Sun, Jun 14, 2009 at 11:03 PM, Golam Mortuza
> Hossain<gmhoss...@gmail.com> wrote:

>> Hi

>> On Sun, Jun 14, 2009 at 4:38 PM, Burcin Erocal<bur...@erocal.org> wrote:
>>> There were long discussion about the typesetting of partial derivatives
>>> in the new system, but I don't think we got to a conclusion yet.

>> I am afraid, we might never reach a conclusion in this regard :-)

> Yes we will.  It doesn't have to be unanimous, but we will reach a conclusion.

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

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 16 2009, 1:20 pm
From: kcrisman <kcris...@gmail.com>
Date: Tue, 16 Jun 2009 10:20:40 -0700 (PDT)
Local: Tues, Jun 16 2009 1:20 pm
Subject: Re: typesetting partial derivatives

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

Does that also apply to Golam's earlier comment

(a) If we all agree that there is no ambiguity when the particular
argument is a "symbolic variable" or "symbolic function" then
we should typeset them as those found in text-books.
Ex:
(1)  D[0,0,0] (f)(x,y)    =>  \frac{\partial^3}{\partial x^3} f
(x,y)
(2)  D[0] (f)(g(x,y), h(z)) =>  \frac{\partial}{\partial
g(x,y)} f(g(x,y), h(y))

so that we will no longer see nicely typeset partial derivatives even
in case (a)(1) (or even Leibniz notation at all?), or is it only in
the case (b) "when the argument is an expression"?    Thanks for the
clarification.

- kcrisman

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 16 2009, 2:08 pm
From: William Stein <wst...@gmail.com>
Date: Tue, 16 Jun 2009 20:08:49 +0200
Local: Tues, Jun 16 2009 2:08 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives

I don't know. It didn't seem to me that people voted on that more refined point.

-- William

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 16 2009, 6:42 pm
From: Golam Mortuza Hossain <gmhoss...@gmail.com>
Date: Tue, 16 Jun 2009 19:42:46 -0300
Local: Tues, Jun 16 2009 6:42 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives
Hi,

As Burcin pointed  out that even MMA uses different Tex-ing scheme
for some situations such as  F'[x] for D[F[x],x]. So strictly speaking even
MMA uses hybrid approach.

I guess, we should aim for doing better than MMA/Maple.

Cheers,
Golam

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 17 2009, 2:23 am
Date: Tue, 16 Jun 2009 23:23:00 -0700
Subject: Re: [sage-devel] Re: typesetting partial derivatives
On Jun 14, 2009, at 1:19 PM, William Stein wrote:

> Personally, I prefer the Mathematica notation because I can actually
> read it.  I have (serious!) trouble reading the current notation that
> Sage uses and I can barely read the Maple notation either.  With the
> Mathematica notation it is totally completely obvious to me what is
> going on.

If it wasn't obvious from my previous comments in former threads, I
am of this opinion as well. I would actually be for disallowing the
bare function('f') from the global namespace altogether and forcing
the user to provide named, ordered dummy variables (what does it
actually mean?)

- Robert

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 17 2009, 3:20 am
From: William Stein <wst...@gmail.com>
Date: Wed, 17 Jun 2009 09:20:31 +0200
Local: Wed, Jun 17 2009 3:20 am
Subject: Re: [sage-devel] Re: typesetting partial derivatives
On Wed, Jun 17, 2009 at 8:23 AM, Robert

> On Jun 14, 2009, at 1:19 PM, William Stein wrote:

>> Personally, I prefer the Mathematica notation because I can actually
>> read it.  I have (serious!) trouble reading the current notation that
>> Sage uses and I can barely read the Maple notation either.  With the
>> Mathematica notation it is totally completely obvious to me what is
>> going on.

> If it wasn't obvious from my previous comments in former threads, I
> am of this opinion as well. I would actually be for disallowing the
> bare function('f') from the global namespace altogether and forcing
> the user to provide named, ordered dummy variables (what does it
> actually mean?)

I'm not opposed to that suggestion.  I have no idea what
"function('f')" even means.

William

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 17 2009, 8:01 am
From: Burcin Erocal <bur...@erocal.org>
Date: Wed, 17 Jun 2009 14:01:59 +0200
Local: Wed, Jun 17 2009 8:01 am
Subject: Re: [sage-devel] Re: typesetting partial derivatives
On Wed, 17 Jun 2009 09:20:31 +0200

I don't think forcing the user to provide dummy variables when creating
the function is a good approach. I don't see where the variables
would be needed, other than printing differentials. If we go with the
MMA notation we won't need them even then.

It makes sense to provide a function that takes the variables as
arguments, and pretty prints differentials with the df/dx notation
though. We already have the code to do this, afair first written by
Jason, and now Golam.

Cheers,

Burcin

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 23 2009, 8:00 pm
From: Burcin Erocal <bur...@erocal.org>
Date: Wed, 24 Jun 2009 02:00:41 +0200
Local: Tues, Jun 23 2009 8:00 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives
On Tue, 16 Jun 2009 19:42:46 -0300
Golam Mortuza Hossain <gmhoss...@gmail.com> wrote:

I don't think what MMA does can really be called a hybrid approach. It
just represents first and second derivatives of single argument
functions with F' and F'', instead of F^{(1)} and F^{(2)} respectively.

John Palmieri wrote in a different thread:

> I don't like the D[1] notation at all.  By the way, when we have a
> function f of two variables, should we automatically assume that the
> mixed partials are equal? Does this affect our choice of notation?

I guess we assume that they commute:

sage: var('x,y,z')
(x, y, z)
sage: t = f(x,y)
sage: diff(t,x,y)
D[0, 1](f)(x, y)
sage: diff(t,y)
D[1](f)(x, y)
sage: diff(t,y,x)
D[0, 1](f)(x, y)

> I guess, we should aim for doing better than MMA/Maple.

What would the hybrid approach be in this case? Use Maple convention,
but use MMA style F^{(4, 0} instead of D[1,1,1,1]F[x+y,y] or F^{(3,1)}

I would like to settle this vote and get rid of the D[...] notation as
soon as possible, but William's count of 4 votes for MMA notation to 2
votes for Maple notation doesn't look decisive. At least I can't
believe there were so few responses. :)

If there are no objections to the above definition of "hybrid approach",
the options for default printing are:

1) Mathematica style
2) Maple style
3) hybrid

For all cases, we would need to provide a function that takes the names
of the arguments of the given symbolic function as a parameter and
typesets the expression in "textbook style"

I still vote for 1, MMA style. To state the reasons again, it's
consistent, and concise.

Cheers,
Burcin

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 24 2009, 10:58 am
From: Golam Mortuza Hossain <gmhoss...@gmail.com>
Date: Wed, 24 Jun 2009 11:58:19 -0300
Local: Wed, Jun 24 2009 10:58 am
Subject: Re: [sage-devel] Re: typesetting partial derivatives
Hi

On Tue, Jun 23, 2009 at 9:00 PM, Burcin Erocal<bur...@erocal.org> wrote:
> If there are no objections to the above definition of "hybrid approach",
> the options for default printing are:

> 1) Mathematica style
> 2) Maple style
> 3) hybrid

> I still vote for 1, MMA style. To state the reasons again, it's
> consistent, and concise.

Burcin, I am giving you my vote also, for implementing MMA
style typesetting as the default one for partial derivatives.  Please
have those {'} and {''} and may be even {'''} notations.

So I would urge you to go ahead with the implementation.

It wouldn't be difficult to add other choices later as options
to users (some of the codes are already there).

Cheers,
Golam

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 24 2009, 11:10 am
From: Jason Grout <jason-s...@creativetrax.com>
Date: Wed, 24 Jun 2009 08:10:15 -0700
Local: Wed, Jun 24 2009 11:10 am
Subject: Re: typesetting partial derivatives

+1 for the MMA style.

Jason

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 24 2009, 12:19 pm
From: Nick Alexander <ncalexan...@gmail.com>
Date: Wed, 24 Jun 2009 09:19:35 -0700
Local: Wed, Jun 24 2009 12:19 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives

> +1 for the MMA style.

I am +1 for mathematica style, but can someone explain why

In[5]:= D[F[x+2*y], x, x]

Out[5]= F''[x + 2 y]

Why is x somehow considered special and y not?

Nick

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 24 2009, 12:42 pm
From: John Cremona <john.crem...@gmail.com>
Date: Wed, 24 Jun 2009 17:42:04 +0100
Local: Wed, Jun 24 2009 12:42 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives
2009/6/24 Nick Alexander <ncalexan...@gmail.com>:

>> +1 for the MMA style.

> I am +1 for mathematica style, but can someone explain why

> In[5]:= D[F[x+2*y], x, x]

> Out[5]= F''[x + 2 y]

> Why is x somehow considered special and y not?

F is a function of one variable.  F'' is its second derivative.  It's
nothing to do with x and y being special.

John

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 24 2009, 1:43 pm
From: Nick Alexander <ncalexan...@gmail.com>
Date: Wed, 24 Jun 2009 10:43:26 -0700
Local: Wed, Jun 24 2009 1:43 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives

On 24-Jun-09, at 9:42 AM, John Cremona wrote:

I missed that.

Thanks,
Nick

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 24 2009, 5:54 pm
From: Burcin Erocal <bur...@erocal.org>
Date: Wed, 24 Jun 2009 23:54:18 +0200
Local: Wed, Jun 24 2009 5:54 pm
Subject: Re: [sage-devel] Re: typesetting partial derivatives
Hi Golam,

On Wed, 24 Jun 2009 11:58:19 -0300
Golam Mortuza Hossain <gmhoss...@gmail.com> wrote:

:) I was hoping you'd implement it, since you did it in #5711 once.

I attached a patch to the trac ticket that contains an initial attempt
at the MMA notation:

It doesn't work well for text mode:

sage: f = function('f')
sage: f(x).derivative(x,3)
f^{(3)}(x)

Comments, suggestions and patches are welcome.

Thanks.

Burcin

To post a message you must first join this group.
You do not have the permission required to post.
More options Jun 25 2009, 10:43 am
From: Golam Mortuza Hossain <gmhoss...@gmail.com>
Date: Thu, 25 Jun 2009 11:43:44 -0300
Local: Thurs, Jun 25 2009 10:43 am
Subject: Re: [sage-devel] Re: typesetting partial derivatives
Hi Burcin,

On Wed, Jun 24, 2009 at 6:54 PM, Burcin Erocal<bur...@erocal.org> wrote:
> I attached a patch to the trac ticket that contains an initial attempt
> at the MMA notation:

> It doesn't work well for text mode:

> sage: f = function('f')
> sage: f(x).derivative(x,3)
> f^{(3)}(x)

My suggestion would be to split out "text-mode" (repr) output
for another ticket.  Current text-mode output expression from Sage
in this case is not a valid input expression of Sage. For example,
if I do copy-n-paste output like  "D[0](f)(x)"  to another cell then
Sage doesn't recognize it.

I guess, implementing latex output would be easier one. I did
a quick-hack MMA style.  It worked fine and with primes
it appears to be in  "textbook style".

Cheers,
Golam

To post a message you must first join this group.
You do not have the permission required to post.
More options Jul 18 2009, 7:49 pm
From: Jason Grout <jason-s...@creativetrax.com>
Date: Sat, 18 Jul 2009 16:49:41 -0700
Local: Sat, Jul 18 2009 7:49 pm
Subject: Re: typesetting partial derivatives

Burcin Erocal wrote:
> I attached a patch to the trac ticket that contains an initial attempt
> at the MMA notation:
FYI, a few days ago Burcin uploaded a new patch on 6344 and asked for
review.  Here are the examples:

OLD:

sage: var('x,y')
sage: f = function('f')
sage: f(x).derivative(x)
D[0](f)(x)
sage: f(x,x).derivative(x,2)
D[0, 0](f)(x, x) + 2*D[0, 1](f)(x, x) + D[1, 1](f)(x, x)

NEW:

sage: f(x).derivative(x)
D[1](f)(x)
sage: f(x,x).derivative(x,2)
D[2, 0](f)(x, x) + 2*D[1, 1](f)(x, x) + D[0, 2](f)(x, x)

NEW LATEX:

sage: latex(f(x).derivative(x))
f'\left(x\right)
sage: latex(f(x,x).derivative(x,2))
f^{(2,0)}\left(x, x\right) + 2 \, f^{(1,1)}\left(x, x\right) +
f^{(0,2)}\left(x, x\right)

More examples:

sage: binomial(x,y).derivative(x)
<boom>
sage: latex(floor(x).derivative(x))
D[0]\left \lfloor x \right \rfloor
sage: latex(ceil(x).derivative(x))
D[0]\left \lceil x \right \rceil

If you have an issue with the above printing, please speak now!  If you
like this, it'd be great if you'd chime in as well.

Burcin indicates that this is a stepping stone, not necessarily a final
implementation.  However, Burcin points out that we ought to settle on a
suitable output soon and move on from this issue.

Thanks,

Jason