1 | initial version |

It's true that the *global function* `diff`

applies only to symbolic expressions, not to coordinate functions as defined in SageManifolds. But you can use the *method* `diff`

on them:

```
sage: Lx[3].diff(th)
-sin(ph)/sin(th)^2
```

Note that the result is still a coordinate function:

```
sage: type(Lx[3].diff(th))
<class 'sage.manifolds.coord_func_symb.CoordFunctionSymb'>
```

To get a symbolic expression, use the method `expr()`

:

```
sage: Lx[3].diff(th).expr()
-sin(ph)/sin(th)^2
sage: type(Lx[3].diff(th).expr())
<type 'sage.symbolic.expression.Expression'>
```

Another solution is to invoke `expr()`

prior to the global function `diff`

:

```
sage: diff(Lx[3].expr(), th)
-cos(th)^2*sin(ph)/sin(th)^2 - sin(ph)
```

Note that in this case, the result is not automatically simplified (this is one of the differences between symbolic expressions and coordinate functions).

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.