On Apr 6, 2:15 pm, Michael Orlitzky <mich...@orlitzky.com> wrote:
> That was a too-simple example. You can't create e.g. a cubic spline
> because of the evaluated derivatives. In general the form over [-1,1]
> would look like,
>
>   s(f;x) = a(x)*f(-1) + b(x)*f'(-1) + c(x)*f(1) + d(x)*f'(1)
>

Doesn't this do what you want? (probably needs #12796)

sage: a=function('a',nargs=1)
sage: b=function('b',nargs=1)
sage: c=function('c',nargs=1)
sage: d=function('d',nargs=1)
sage: f=function('f',nargs=1)
sage: from sage.symbolic.operators import FDerivativeOperator
sage: fprime=FDerivativeOperator(f,[0])
sage: s=a(x)*f(-1) + b(x)*fprime(-1) + c(x)*f(1) + d(x)*fprime(1)
sage: s
a(x)*f(-1) + b(x)*D[0](f)(-1) + c(x)*f(1) + d(x)*D[0](f)(1)
sage: s.substitute_function(f,sin)
-sin(1)*a(x) + sin(1)*c(x) + cos(1)*b(x) + cos(1)*d(x)
sage: s.coeff(f(1))
c(x)
sage: s.coeff(sin(pi))
0

I suspect that you're reaching the limits of usefulness of the
symbolic ring by now, though. It's probably easier to keep things
sorted yourself rather than mashing it all together in a big symbolic
expression and hope you can fish out the useful bits later on again.
Probably throwing some linear algebra at your problem will keep the
structure much cleaner.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to