Hi Burcin,

Thank you very much for your reply. It partly solved my problem :)
Now I still have one more problem. For instance, referring to earlier
example, suppose now i want to differentiate a function of both
"theta" and "omega" w.r.t "omega". Now sage gives an error saying that
the it should be a symbol to do the differentiation. It seems, that I
cannot do it. In practical scenario, in case of obtaining Euler-
Lagrange equation, i need to differentiate w.r.t "omega". Any further
help will be highly appreciated.

Regards,
Isuru

On May 29, 7:57 pm, Burcin Erocal <[email protected]> wrote:
> Hi,
>
> On Sat, 29 May 2010 08:39:17 -0700 (PDT)
>
> isurug <[email protected]> wrote:
> > I was wondering if there is any support in sagemath to define new
> > variables that are derivatives or integrals of existing variables. for
> > instance, suppose that i define a variable called "theta" , is it now
> > possible to define "omega" that is omega=thetal.derivative(t). This
> > problem occured when i tried to do some derivations in mechanics. Any
> > help will be highly appreciated.
>
> sage: var('t')
> t
> sage: function('omega')
> omega
> sage: def d(self, x, diff_param=None):
> ....:     return omega(x)
> ....:
> sage: function('theta',derivative_func=d)
> theta
> sage: theta(t).derivative(t)
> omega(t)
> sage: theta(2*t^2).derivative(t)
> 4*t*omega(2*t^2)
>
> To see all the options accepted by the global function constructor see
>
> sage: sage.symbolic.function_factory.function?
>
> Perhaps we should change this construction so it just works with:
>
> sage: def d(x, diff_param=None):
> ....:     return omega(x)
> ....:
> sage: function('theta',derivative_func=d)
>
> Cheers,
> Burcin

-- 
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-support
URL: http://www.sagemath.org

Reply via email to