On Aug 26, 2008, at 12:37 AM, William Stein wrote:

Well I really hope that you implement a bunch of stuff for inclusion in Sage!
So far we have very very very few developers working on symbolic
differential equations stuff in Sage.  (I.e., none, as far as I know.)

Besides the code I already posted, I have written other variational calculus code. However, I need to work with things on a term-by-term basis so I need
access to the expression tree which I couldn't find out how to work with
based upon the Sage documentation (e.g., commands like Maple's op allow one to
pull apart the symbolic expression term by term).

Plus, based upon how integration and differentiation is currently
implemented (as I understand it), I'd have to drop into Maxima to do
that manipulation.

That Euler-Lagrange code is simple example. It consists basically
of:

1) Replacing all functions specified with placeholder symbols.
2) Differentiation with respect to those symbols.
3) Reversing the replacement.
4) Differentiation of one expression with respect to time.

Since you don't know the number of functions in advance, you
need to programmatically create the replacement list and reverse
subs list. Both Maple and Maxima can do it fairly simply. Based upon
how Sage works, I'm not exactly clear on how to do step 1 which is
this Maple code:

        # create a list of indices from 1 to the number of variables
        # used in the formulation
        num_list := [seq(i,i=1..nops(variables))]:

        # Define a list of generalized velocity and position variables
        qv_name := map2(cat,qv,num_list):
        q_name := map2(cat,q,num_list):

        # Equate the time derivatives of the system variable to the
        # generalized velocities and also define the reverse mapping
        vel_var := map(diff,variables,t):
        qv_subs := zip(equate,vel_var,qv_name):
        qv_unsubs := zip(equate,qv_name,vel_var):

        # Equate the generalized positions to the system variables
        # and define the reverse mapping
        q_subs := zip(equate,variables,q_name):
        q_unsubs := zip(equate,q_name,variables):

Can I programmatically create a symbolic variable name and use
that to replace a symbolic function name? If it's possible, I probably
can code the rest in Sage fairly quickly. Then, I'll just be waiting
on some of the expression manipulation tools.

Cheers,

Tim.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to