Calculate

c-calculate

c-calculate is the most basic and frequently used CalcBot command. Simply run c-calculate (or c-c for short), followed by an expression to get the result:

> c-calculate 0.45/240
0.001875

> c-calculate sin(2pi)
0

> c-calculate 0.279*3.11
0.86769

You can declare variables and use them within expressions. Use c-calculate variables to display your defined evariables, and c-calculate delete to delete them:

> c-calculate x=5
5

> c-calculate x=x^2
25

> c-calculate y=6!
720

> c-calculate x+y
745

> c-calculate variables
x: 25
y: 720
ans: 745

> c-calculate delete x y
Sucessfuly deleted variables and functions:
x: 25
y: 720

> c-calculate x+y
`x` is not defined.

The special variable ans refers to the result of the last calculation you ran:

You have access to these constants:

CalcBot supports complex numbers:

You can use prime notation with any function in order to get the estimated nth-order derivative of the function (aka derivative at a point):

Predefined functions

The calculate command features a large collection of predefined functions. You can find the full list at the function reference.

Custom functions

You can create custom functions for use in calculate and some other commands across CalcBot. You can define custom functions as if they were a variable. For example, here is a custom function that returns an approximation of the sin function:

You can now use this function like any other function:

Custom functions can also have more than one parameter:

Custom functions can even have default / optional parameters. In this example function, if a user does not provide any argument, x will by default be set to 5:

Children commands

The calculate command also has a very large host of children commands. The most prominent are:

c-calculate derivative / c-calculate integral / c-calculate numintegrate

Self-explanatory:

c-calculate limit

Estimate the limit of an expression in terms of x as x approaches a certain value:

Piecewise functions

CalcBot's limit command allows you to input piecewise functions. To enter a piecewise function, type the condition, followed by a colon (:), and the expression for that condition. For example:

This computes the limit of a piecewise function defined in the region 0 <= x <= pi, with the function sin(x), as x approaches pi/2.

You can add more condition / function pairs after the first one by separating each condition / function pair with a colon (:):

Here, 0 <= x <= pi is associated with the expression sin(x), and pi < x <= 10 is associated with the expression x/pi-1.

To summarize, this is the syntax for inputting piecewise functions:

c-calculate mode

Change the calculation mode of c-calculate to radians or degrees (you can type r or d for short):

c-calculate newtonmethod

Utilizes the Newton-Raphson method to solve for roots of an expression equal to 0. There are a few caveats to this method, however: (1) the method requires that the derivative of the expression be calculable, which isn't possible for certain expressions; (2) the method can't reliably detect if there are no roots; (3) the results are an approximation of the roots, which is why the precision of the result can sometimes be relatively awkward.

Despite this, Newton's method is still very powerful and can compute highly accurate approximations of roots if the conditions above are laid out.

c-calculate simplify

Simplify an algebraic expression:

Clicking the show steps button on the response message will display a list of steps taken to reach the result:

c-calculate solvefor

This is also a popular children command of CalcBot. Use it to algebraically solve for a variable in an equation. Note, that by not including an equal sign (=), CalcBot assumes the expression is equal to 0, like the first example below:

c-calculate tofraction

This command accepts an expression / decimal number and converts it to a fraction. You can also use this command to simplify fractions. Enclose a number / section of numbers with parenthesis to specify that that section repeats, and / or enter a value for the fourth argument to return the result as a mixed fraction:

Last updated

Was this helpful?