Hi, On Tue, Jul 7, 2009 at 10:29 PM, William Stein<wst...@gmail.com> wrote: >> In new symbolics, if I do the same I get >> -------- >> sage: g >> D[0](f)(x) >> sage: g.subs_expr(f(x)==f(x)+df(x)) >> D[0](f)(x) >> --------- >> >> Is there a way to do this in new symbolics? It seems >> to be a road block in implementing calculus of variations >> in new symbolics. > > I don't see any way to do this yet, which is frustrating. This was as > close as I got, which is really awful: > > sage: g.operator().change_function(f(x)+df(x))(x) > D[0](f)(x) + D[0](df)(x)
I got another workaround ----- for n in range(max): S = S.subs_expr(f(x).diff(x,n)==(f(x)+df(x)).diff(x,n)) ----- It gets my work done as I know 'max' for my problems. However, I think we need a proper solution not a workaround. > I really hope once we get these issues sorted out and you implement > calculus of variations, that you include it in Sage. Definitely! Right now, I see four issues that need to be sorted out before calculus of variations can be implemented in Sage. (1) Improved .subs_expr() method so that one can vary a functional of the form S0 = L( q(t), q(t).diff(t) ).integral(t, -oo, oo) to S = L( q(t) + dq(t), (q(t)+dq(t)).diff(t) ).integral(t, -oo, oo) where dq(t) = epsilon*f(t), f(t) a test function. (2) New D derivative operator does not know how to act on symbolic integration ( #6465 ). So right now it is not possible to compute "S.diff(epsilon)" I have spent last two days in trying to fix this. I believe this is much more serious issue than the previous one and this requires changes in both pynac and sage. Pynac needs to check for special differentiation rules for function like "integrate( f(x,y), x)" before applying chain rules. Current "_derivative_" method of SFunction class is inadequate for this as it is called after chain rule has been applied. (3) In physics, we always use test function "f(t)" to be Dirac delta. This is DONE and will be part of sage-4.1 (4) We also need integration algorithm where integrand involves Dirac delta. This is mostly ready and I will post a ticket once new symbolic integration class is cleaned up so that it can be hooked up properly. So, I guess (1) and (2) need real work mostly in pynac. I was glancing through ginac code. Ginac seems to apply diff() method properly to its own integral() method. Cheers, Golam --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---