On Thu, Aug 21, 2008 at 7:18 AM, Tim Lahey <[EMAIL PROTECTED]> wrote: > > Since M. Hampton mentioned some of the things he missed in Sage, I > thought I'd talk about the things that prevent me from using Sage for > many things. > > 1. Commands to parse expressions. I regularly pull apart expressions > to work with terms or parts of terms so I really miss an op command > (and subsop). Easy access to these along with getting terms of various > types and commands for working with integrals. > > 2. Like M. Hampton, I miss implicit variables. I'm an engineer at > heart so I don't understand rings or fields because I was never taught > them. Also, since I often work > with trig functions, I won't be able to use Polynomial Rings (at least > if I understand > what I've read here). > > 3. Somewhat related to #1, is the ability to make new variables/ > function names from old ones. For example, when in the Calculus of > Variations, I'll create the variation function with a name based on > the function to be varied (e.g., v(x,y,z,t) to \delta v(x,y,z,t)). > I also need this to carry out my EulerLagrange calculation. To > illustrate this, my > Maple code for this is: > > EulerLagrange := proc(Lagrangian::anything, variables::list) > local num_list, qv_name, vel_var, qv_subs, qv_unsubs, Lagrange_subs1, > Lagrange_subs2, dL_dqv1, dL_dqv2, dL_dqv, dL_dqvt, dL_dq, dL_dq1, > dL_dq2, dL_dq3, q_name, q_subs, q_unsubs: > # 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): > > # Convert the Lagrangian to the generalized position and velocity > variables > Lagrange_subs1 := subs(qv_subs,Lagrangian): > Lagrange_subs2 := subs(q_subs,Lagrange_subs1): > > # Differentiate the Lagrangian with respect to the > # generalized velocities and positions > dL_dqv1 := map2(diff,Lagrange_subs2,qv_name): > dL_dq1 := map2(diff,Lagrange_subs2,q_name): > > # Revert back to the system variables > dL_dq2 := map2(subs,qv_unsubs,dL_dq1): > dL_dqv2 := map2(subs,qv_unsubs,dL_dqv1): > dL_dqv := map2(subs,q_unsubs,dL_dqv2): > dL_dq := map2(subs,q_unsubs,dL_dq2): > dL_dqvt := map(diff,dL_dqv,t): > > # Return the two components of the Euler-Lagrange Equation > return (dL_dqvt, dL_dq): > end proc: > > where the equate function used in zip is defined as: > equate := (x,y)->x=y: > > I presume that Sage can't take a derivative with respect to a function > (Maple can't > which is why this code is written this way). This code as written is > two orders > of magnitude faster than Maple's code in the calculus of variations > package. Plus, > it retains the order since it doesn't use sets. > > This is one of the simpler functions in my package. My code to > manipulate integrands in place is much more complicated since it needs > to take into account the possibility of nested integrals. > > If someone can help with #1 and #3, I might be able to port my code to > Sage. I'd really like to do it since Sage has much better LaTeX > support than Maple.
#1 is going to be fixed in the ginac based symbolics. Ondrej --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---