# derivative of x^n

I am working with polynomials. I'd like to compute the symbolic derivative of a monomial with symbolic coefficients, that is something like

```
derivative(x^n,x)
```

So that the output is

```
nx^(n-1)
```

Is this possible?

**Edit:** My first try was of course to use:

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

or

```
derivative(x^n,x)
```

but I get the error

```
TypeError: non-integral exponents not supported
```

Yes. First, type: var('n') This will tell Sage that n is a variable. Then type: diff(x^n,x) Run those two lines and you will get the output you want.

@dazedANDconfused : thanks, but that is the first thing I tried, as that method works with "number exponents". When I put the command I receive an error. I shall edit my question to reflect this.

@hildejk , I was able to run what @ndomes suggested below without error, using sage 6.3.