Hi,

Am Montag, den 12.04.2010, 21:11 -0700 schrieb Alec Mihailovs:
> On Apr 12, 5:57 pm, Eckhard Kosin <e...@mathematik-service-kosin.de>
> wrote:
> 
> > I think I understand:  After
> >
> > expr(x) = sin(x)
> >
> > expr is a symbolic expression and can be differentiated and the same
> > goes for sin after
> >
> > sin(x) = sin(x)
> 
> Yes. And the same thing can be done for other functions. In
> particular, in your example with h2,
> 
> sage: function('f')
> sage: h2 = lambda t: sin(f(t))
> sage: h2(x)=h2(x)
> sage: h2.diff()
> x |--> cos(f(x))*D[0](f)(x)

I fiddled around and got a way to have the derivative of a function to
be a function:

sage: function('f')
f
sage: f(x) = f(x)
sage: Df = f.diff()
sage: Df
x |--> D[0](f)(x)
sage: type(Df)
<type 'sage.symbolic.expression.Expression'>
sage: Df = lambda x: f.diff()(x)
sage: Df
<function <lambda> at 0x40c9a28>
sage: Df(x)
D[0](f)(x)

and, surprise, it works with sin, too:

sage: sin(x) = sin(x)
sage: Dsin = lambda x: sin.diff()(x)
sage: Dsin
<function <lambda> at 0x3d3bed8>
sage: Dsin(x)
cos(x)

But I find this unsatisfactory.  Now we have Dsin a function and sin a
symbolic expression.  Of course, we can get back sin a function with

sage: reset('sin')
sage: type(sin)
<class 'sage.functions.trig.Function_sin'>

That's not straight forward.  For a differentiable function I would like
to have a method, which yields the derivative as a function again.

BTW: How do you define the derivative of a symbolic expression?  You'll
consider it a function and than give the usual definition from calculus,
don't you?

        Eckhard
-- 
Dr. Eckhard Kosin
Services in Mathematics and Simulation

mailto:e...@mathematik-service-kosin.de 
http://www.mathematik-service-kosin.de

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to