On Fri, Sep 19, 2008 at 6:54 AM, Alex Raichev <[EMAIL PROTECTED]> wrote:
>
> Hey all:
>
> I'm back with a follow up question on the topic of substitution in
> Sage.  How can i work the following example?  I have an expression
> that involves the derivative of a function, and into that expression i
> want to substitute the value of the derivative.  Simple, eh?  I tried
> Mike's ** trick and variations thereof, but that doesn't seem to work:
>
> sage: var('x,y')
> (x, y)
> sage: f= function('y',x)
> sage: g= diff(f,x)
> sage: h= diff(f^2,x)
> sage: print h
>
>                                         d
>                              2 y(x) (-- (y(x)))
>                                         dx
>
> sage: print h.substitute(**{str(g):cos(x)})

Use:

sage: h.subs_expr(g == cos(x))
2*cos(x)*y(x)


I think this subs, subs_expr and substitute is very confusing in Sage,
at least to me.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to