1 | initial version |

I'll continue my comment here so the code is clear. Go to a Sage cell server, such as here and copy paste the following code into the box:

```
var('n')
diff(x^n,x)
```

Press "Evaluate" and your output will be: nx^(n-1) Your question indicates that you tried diff(x^n,x) without declaring var('n'). Sage assumes x is a variable but everything else must be declared as a variable.

If you've followed the code above and you don't get nx^(n-1) then you should give the specifics about what version of Sage you are running and whether it is as a notebook or something else.

2 | No.2 Revision |

I'll continue my comment here so the code is clear. Go to a Sage cell server, such as here and copy paste the following code into the box:

```
var('n')
diff(x^n,x)
```

Press "Evaluate" and your output will be: ~~nx^(n-1)
~~nx^(n-1).
Your question indicates that you tried diff(x^n,x) without declaring var('n'). Sage assumes x is a variable but everything else must be declared as a variable.

If you've followed the code above and you don't get nx^(n-1) then you should give the specifics about what version of Sage you are running and whether it is as a notebook or something else.

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.