Ask Your Question

Revision history [back]

click to hide/show revision 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.

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.