Codebymath knows how to differentiate an expression. We have a function called

`diff`

that knows how to differentiate most
polynomial-type expressions. This means figuring out, for example, that
$\frac{d}{dx}2x^2=4x$ and $\frac{d}{dx}\cos^2(x)=-2cos(x)sin(x)$. This can help you
calculus students check your work.
The `diff`

function here is use a lot like the `algebra`

function
from this past lesson.

answer=diff("math-expression","variable")

Move the mouse over a dotted box for more information.

Type your code here:

See your results here:

This example will find the derivative of $2x^2$. You might also try differentiating:

- $2x^2+10x-7$ with respect to $x$.
- $\cos^2(2x)$ with respect to $x$.
- Codebymath knows these functions: sin, cos, tan, csc, sec, log, sqrt, abs, asin, acos, atan, sinh, cosh, tanh, and exp(x) (for $e^x$).

Does your code work? Want to run it on your iPhone?

Here's your code:

- Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
- Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
this page
- Then click the "Use on iPhone" button that you'll see.