On Jul 2, 4:25 pm, Burcin Erocal <bur...@erocal.org> wrote:
> On Fri, 2 Jul 2010 09:21:25 -0700 (PDT)
>
> Ryan Hinton <iob...@email.com> wrote:
> > Well, it's a little dangerous for someone (me) who doesn't really
> > understand how to *use* the tool to *design the interface* to the
> > tool.  But since I'm rarely bothered by my own ignorance, I'll charge
> > ahead. :-)
>
> > After writing a long, detailed email, I realized it's probably better
> > to start a wiki page instead.  See
>
> > <http://wiki.sagemath.org/symbolics/Indexedexpressions>
>
> > for my thoughts.  Thanks for your help!
>
> The wiki page is a good idea. Thanks for taking the time to write your
> ideas up.
>
> Here is a patch with the first steps to use indexed expressions:
>
> http://sage.math.washington.edu/home/burcin/indexed_expression.patch
>
> I used the slice notation to denote dimensions. If you have a
> variable x, and you want an index with dimension 3, you write:
>
> sage: var('i')
> i
> sage: x[i:3]
> x.i
>
> Dimensions are not printed, but they are there. :)
>
> I'm afraid I don't understand what you expect sum() to do. We already
> have a sum() method for symbolic expressions. Please take that into
> account as well.
>
> Note that GiNaC cannot take derivatives of indexed expressions [1].
> Perhaps this is a show stopper for you.
>
> [1]http://www.ginac.de/reference/classGiNaC_1_1indexed.html#a0c7f2f4501e...
>
> On a completely different note... I prefer to use the brackets to access
> the operands of an expression, instead of creating indexed expressions.
> There has been several complaints about not being able to access the
> operands lately, and I think this is the most natural way to do so.
>
> You will see that there is already a __getitem__() method in
> expression.pyx which was commented during the symbolics switch. I
> suggest we uncomment that and use a different method (.indexed()?) for
> the indexed expressions.
>
> Cheers,
> Burcin

Thank you very much for your work.  Your guess is correct: I need to
take derivatives.  What I want is something like the following.

sage: var('x, d, i, n')
sage: monomial = (x[i:n] ^ d[i:n]).product()  # form a product of all
the x[i]^d[i]
sage: partial = monomial.derivative(x[i])

So ``partial`` should look something like

d[i] * x[1]^d[1] * x[2]^d[2] * ... * x[i]^(d[i] - 1) * ... * x[n]^d[n]

but I don't know how this would be calculated or displayed.  Of
course, then I need to weight and sum several (another symbolic
dimension) of these monomials, take derivatives of these sums, etc.

As for syntax, I think the slice syntax is clever and fairly
intuitive.  I can also understand using brackets to access operands in
an expression.  Personally, I think the brackets make more sense for
indexing, but they would probably see more use for operand access.  It
wouldn't bother me to use an ``indexed()`` method instead.  I would be
happy to review a patch to add either one.

Thanks again!

- Ryan

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

Reply via email to