Ask Your Question

Revision history [back]

Is there something wrong with the following example for computing Jacobian ?

sage: var('x y')
sage: f(x,y) = (x^2+y, x-sin(y))
sage: f.derivative()
[    (x, y) |--> 2*x       (x, y) |--> 1]
[      (x, y) |--> 1 (x, y) |--> -cos(y)]
sage: f.derivative()(x=0,y=2)
[      0       1]
[      1 -cos(2)]

Concerning composition, this is indeed more tricky, because:

sage: f(x,y).parent()
Vector space of dimension 2 over Symbolic Ring

So, you could try:

sage: g(x,y) = (2*y,x)
sage: g(f[0],f[1])    
(2*x - 2*sin(y), x^2 + y)

Is there something wrong with the following example for computing Jacobian ?

sage: var('x y')
sage: f(x,y) f(x, y) = (x^2+y, x-sin(y))
(x^2 + y, x - sin(y))
sage: f.derivative()
[    (x, y) |--> 2*x       (x, y) |--> 1]
[      (x, y) |--> 1 (x, y) |--> -cos(y)]
sage: f.derivative()(x=0,y=2)
f.derivative()(x=0, y=2)
[      0       1]
[      1 -cos(2)]

Concerning composition, this is indeed more tricky, because:

sage: f(x,y).parent()
f(x, y).parent()
Vector space of dimension 2 over Symbolic Ring

So, you could try:

sage: g(x,y) g(x, y) = (2*y,x)
(2*y, x)
sage: g(f[0],f[1]) g(f[0], f[1])    
(2*x - 2*sin(y), x^2 + y)