2.1 Differentiation

Differentiation:

sage: var('x k w')
(x, k, w)
sage: f = x^3 * e^(k*x) * sin(w*x); f
x^3*e^(k*x)*sin(w*x)
sage: f.diff(x)
k*x^3*e^(k*x)*sin(w*x) + 3*x^2*e^(k*x)*sin(w*x) + w*x^3*e^(k*x)*cos(w*x)
sage: print diff(f, x)
           3   k x               2   k x               3   k x
        k x   e    sin(w x) + 3 x   e    sin(w x) + w x   e    cos(w x)
sage: latex(f.diff(x))
{{{k {x}^{3} } {e}^{{k x}} } \sin \left( {w x} \right)}
+ {{{3 {x}^{2} } {e}^{{k x}} } \sin \left( {w x} \right)}
+ {{{w {x}^{3} } {e}^{{k x}} } \cos \left( {w x} \right)}
If you type view(f.diff('x')) another window will open up displaying the compiled LaTeX output. In the Sage notebook, you can enter
f = maxima('x^3 * %e^(k*x) * sin(w*x)')
show(f)
show(f.diff('x'))
into a cell and press shift-enter for a similar result. You can also call Maxima indirectly using the commands
R = PolynomialRing(QQ,"x")
x = R.gen()
p = x^2 + 1
show(p.derivative())
show(p.integral())
in a notebook cell, or
sage: R = PolynomialRing(QQ,"x")
sage: x = R.gen()
sage: p = x^2 + 1
sage: view(p.derivative()) #optional
sage: view(p.integral()) #optional
on the command line.



Subsections
See About this document... for information on suggesting changes.