# Chapter 3. Using the Calculator

KAlgebra's calculator is useful as a calculator on steroids. The user may enter expressions for evaluation in Calculate or Evaluate mode, depending on the Calculator menu selection.

In evaluation mode KAlgebra simplifies the expression even if it sees an undefined variable. When in calculation mode KAlgebra, calculates everything and if it finds an undefined variable shows an error.

In addition to displaying the user entered equations and results in the Calculator display, all variables that are declared are displayed in a persistent frame to the right. By double clicking on a variable you will see a dialog that lets you change their values (just a way to trick the log).

The `ans` variable is special, every time you enter an expression, the `ans` variable value will be changed to the last result.

The following are example functions that can be entered in the input field of the calculator window:

• `sin(pi)`

• `k:=33`

• `sum(k*x : x=0..10)`

• `f:=p->p*k`

• `f(pi)`

The following shows a screenshot of the calculator window after entering the above example expressions: A user can control the execution of a series of calculations using the Calculator menu options:

Executes the instructions in a file sequentially. Useful if you want to define some libraries or resume some previous work.

CalculatorRecent Scripts

Displays a submenu that will allow you to choose the recently executed scripts.

CalculatorSave Script... (Ctrl+G)

Saves the instructions you have typed since the session began to be able to reuse. Generates text files so it should be easy to fix using any text editor, like Kate.

CalculatorExport Log... (Ctrl+S)

Saves the log with all results into an HTML file to be able to print or publish.

CalculatorInsert ans... (F3)

Insert the `ans` variable and makes it easier to reuse older values.

CalculatorCalculate

A radio button to set the Execution Mode to calculation.

CalculatorEvaluate

A radio button to set the Execution Mode to evaluation.