Nils Bruin wrote:
> On Sep 8, 9:40 am, Golam Mortuza Hossain <gmhoss...@gmail.com> wrote:
>> The issue is what to do when a user explicitly ask to apply chain rule
>> by over-riding default setting but provides f(x,x) as the function?
> 
> Ah, I see. You are applying the wrong chain rule. You need
> multivariate calculus. f(x,x) is a composition of two functions:
> 
> g: x:-> (x,x) and h: (y,z) :-> h(y,z).
> 
> in this setting, you have
> 
> f=h(g(x))
> 
> and the appropriate derivative falls out by taking the composition of
> the total derivatives of g and h, so if we name
> 
> g(x)= (g_1(x), g_2(x))
> 
> you get that f.diff(x) should be equal to to the row-vector times
> column vector:
> 
> [ D[0](h)( g(x)), D[1](h) (g(x)) ] * [ D[0](g_1) (x) , D[0](g_2)(x) ]
> ^T
> 
> I think this example actually shows why computer algebra systems
> prefer to implement "positional derivatives", why it's worthwhile have
> conventional "named partial derivatives" and why encoding one into the
> other is more than a mere translation of notation.
>


Nice example of a total derivative.  I teach calc 3 differentiation 
based on the total derivative, and wish Sage had nice support for it. 
Right now, we can have hessian and jacobian functions, but it would be 
nice if a student could just do diff() on a multivariable function, 
specifying multiple variables, and come out with a vector or matrix.

Mathematica can do this:

D[x^2 Sin[y], {{x, y}}] gives {2 x Sin[y], x^2 Cos[y]}

See http://reference.wolfram.com/mathematica/ref/D.html?q=D&lang=en

In particular, see the rules under "More Information".

It would be nice if we could do something like:

diff(f(x,y), (x,y)), or maybe diff( f(x,y), ((x,y), 2) ) to keep syntax 
the same (variable, times to differentiate)                     

and get a matrix out.

Jason

-- 
Jason Grout


--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to