On 7/28/07, Tim Lahey <[EMAIL PROTECTED]> wrote: > > Looking through the documentation, I haven't seen any examples of > using a function name without it being defined first. I've been using > Maple for years and I have a lot of code that relies upon this. This > also ties into a second question related to integration. Is there any > way to delay the integration? Maple provides inert derivatives and > integrals so you can display something as an derivative or integral > and delay the evaluation until later.
You could try this: sage: de = lambda y: diff(y,x) + y - 1 sage: de(x^2) x^2 + 2*x - 1 sage: ie = lambda y: integrate(y,x) + y - 1 sage: ie(x^2) x^3/3 + x^2 - 1 They might be better ways of doing what you want though. > > The reason I ask is that I often work with functions that are unknown > (e.g., variations from the calculus of variations) or are approximated > (and I want to investigate the effects of different approximations). > In Maple I often have integrals that have terms that look like: > > Int(Int(Int(Int(u(x,y,z,t)*Diff(deltau(x,y,z,t),x),x),y),z),t) > > If the CAS is going to try to evaluate each integral at every > computational step, it can get very expensive. The simplest work > around is to work with the integrands until the last step, but it > isn't ideal because this means you have to keep track of what terms > correspond to each integral. For instance, in the example above, you > need to integrate by parts to eliminate the derivative on the deltau > term. So, without the integrals in place, so bookkeeping is necessary. > > Thanks, > > Tim Lahey > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-forum URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---
