| Allow me to start with a definition. Given a function $u = u(x)$, a function $L$ of $x, u$, and all derivatives of $u$; and $I = \int L(x,u,u_x u_{xx}, \ldots)dx$ the variational derivative of $I$ is defined as $\frac{\delta I}{\delta u} := \frac{\partial L}{\partial u} - \frac{d}{dx} \frac{\partial L}{\partial u_x} + \frac{d^2}{dx^2} \frac{\partial L}{\partial u_{xx}} - \cdots$ For example, with $L=u^3 + u_x^2/2$ we have $\frac{\delta I}{\delta u} = 3u^2 - u_{xx}$. From my poking around I suspect that Sage doesn't have the option of computing the variational derivative of an integral operator. However, I'd like to write some code that does this. Does anyone have any suggestions on how to go about doing this? One issue is that if you define a function you can take derivatives of My thoughts include doing some string parsing so I can take the necessary derivatives with respect to $u,u_x,u_{xx},\ldots$ but that's starting to sound a bit messy. Any suggestions on how to cleanly go about doing this in Sage would be greatly appreciated!
I don't have any ideas, but it sounds interesting :)
niles (Feb 08 '11)
Well, I have some ideas of my own on how to implement this but it involves string parsing which I don't consider an elegant approach. Just looking for some ideas. :)
cswiercz (Feb 08 '11)
I have no nice answers either, but support would definitely be worth adding. There are ways to hack around it in any given case, but they're not pretty. I think there was a related thread a while back: http://www.mail-archive.com/sage-devel@googlegroups.com/msg22657.htmlDSM (Feb 08 '11)
Thanks for the reference. That conversation happened in 2009. I wonder what came of it...hrm.
cswiercz (Feb 08 '11)
I was also looking for a solution to this problem. I notice that there is a very old trac request http://trac.sagemath.org/sage_trac/ticket/6466 which has not been acted on in 19 months.
DaveP (Feb 08 '11)
see 3 more comments
|
| The trick is to substitute Given the python module called Note that Here is the module The bulk of the code is rather uninteresting. For example, the generator Unfornately, there is a bug which I do not know how to cleanly circumvent. It is due to the line
In general, this stuff is possible, but it would be worth seeing how people use Ginac and/or Maxima to do this, then see how that would work. What we don't want is semi-hacky things that are really hard to extend, or to fix later - this is some of the current problem, in fact. But if this turns out to be extensible, that would be wonderful! There is a lot of symbolic stuff physicists would like that has thus far languished.
kcrisman (Apr 25 '11) You can use |
Asked: Feb 07 '11
Seen: 523 times
Last updated: Apr 25 '11
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.