# Functions

If you enter the function \(f(x)=0.5x^2-3x+1 \) in the input bar and press enter, the graph will appear. You can drag the graph and watch how the formula for the function changes in the algebra view.

When using GeoGebra it is easy to show the graph of general functions. To make a general cubic function, like in the applet above, insert four sliders a, b, c, d and then write the function as:

f(x)=ax^3+bx^2+cx+d

If the function is called \(f\) you can use the commands `f'(x)`

and
`Integral[f, <Start x-value>, <End x-value>]`

.

The commands `Curvature[<Point>,<Function>]`

and `CurvatureVector[<Point>,<Function>]`

can be used to display the osculating circle.

If the function is a polynomial you can also use the commands `TurningPoint[<Function>]`

and
`InflectionPoint[<Function>]`

. Note that these commands do not work if the function is entered as an
equation in \(x\) and \(y\), e.g. as `y=x^2+1`

. GeoGebra distinguishes between equations and functions, and
functions are written using brackets, as in \(f(x)\) or \(Malin(x)\).

## Scale the axes

The easiest way to scale the axes is to hold down Shift and hover the mouse over one
of the axes. When the cursor changes its appearance, you can drag that axis by holding down the left mouse button and
drag. If you want to reset the ratio between the axes to 1:1, click
Alt+M or
Cmd+M.
If you want another ratio, right click anywhere in the drawing pad where there
is **no** object and choose `xAxis:yAxis`

.

## Function Inspector

In GeoGebra 4 there is a new tool called `Function Inspector`

.

Using the function inspector, you can inspect a function in an interval

or around a point.

## Degrees and radians

When you enter trigonometric functions, the default unit is radians. If you want to use radians, you can change
the unit on the `x`-axis by right-clicking on the graphics view and pick `Graphics`

.

If you want to use degrees, you have to add the degree-symbol when writing the function, as in:
`f(x)=sin(x° )`

. The short command for entering the degree-symbol is
Ctrl+o.

## Input Box and Composite functions

In the applet above, the Insert Input Box tool is demonstrated. In order to link an input box to a function, start by inserting a function:

f(x)=sin(x)

Use the Insert Input Box tool and click in the graphics view, fill in caption and choose the function \(f(x)\) in the Linked Object list.

Making composite functions works as expected. The green and yellow functions in the applet above are entered as:

h(x)=f(x+a) g(x)=f(x)+a

## Inequalities

If you have two expressions in terms of `x`,
you can show for which intervals an inequality holds. As an example you can enter following
code in the input bar: `x^2<=x+1`

.

This is how you write inequalities in GeoGebra:
`<, >, <=, >= `

stands for <, >, ≤ and ≥

## Piecewise defined functions

A piecewise defined function is defined in different ways in different intervals. In GeoGebra you can
define a function on an interval by using the command `Function[]`

.

The functions above are written:

f(x)=Function[1,-10,-1] g(x)=Function[x^2,-1,1] h(x)=Function[2x-1,1,10] f_der(x)=Function[f'(x),-10,-1] g_der(x)=Function[g'(x),-1,1] h_der(x)=Function[h'(x),1,10]

## Riemann sums

There are predefined functions in GeoGebra to make Riemann sums.

- Input a function
- Insert a slider
`n`representing the number of intervals. Make sure that the values of`n`are restricted to positive integers. - Input the lower sum:
`L=LowerSum[f,a,b,n]`

.`a`

and`b`

are the endpoints of the interval. - Input the upper sum:
`U=UpperSum[f,a,b,n]`

- Input the trapezium sum:
`T=TrapeziumSum[f,a,b,n]`

- Input the integral:
`I=Integral[f,a,b]`

## Demonstrate derivative and use FormulaText[]

The recording below shows how to demonstrate the derivative in the same way as on the page Calculus - The Definition of the Derivative.

When displaying information about functions, you can use the text tool in the same way as with other objects. There is also a special command

FormulaText[f]

which will yield the formula of a function as text. This is also shown in the recording below.

by Malin Christersson under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Sweden License