# Evaluables

In addition to simply calculating the averages of some observables in your Monte Carlo simulations, sometimes you are also interested in quantities that are functions of these observables, such as the Binder cumulant which is related to the ratio of moments of the magnetization.

This presents two problems. First, estimating the errors of such quantities is not trivial due to correlations. Second, simply computing functions of quantities with errorbars incurs a bias.

Luckily, Carlo can help you with this by letting you define such quantities – we call them *evaluables* – in the `Carlo.register_evaluables(YourMC, eval, params)`

function.

This function gets an `Evaluator`

which can be used to

`Carlo.evaluate!`

— Function`evaluate!(func::Function, eval::Evaluator, name::Symbol, (ingredients::Symbol...))`

Define an evaluable called `name`

, i.e. a quantity depending on the observable averages `ingredients...`

. The function `func`

will get the ingredients as parameters and should return the value of the evaluable. Carlo will then perform jackknifing to calculate a bias-corrected result with correct error bars that appears together with the observables in the result file.

## Example

This is an example for a `register_evaluables`

implementation for a model of a magnet.

```
using Carlo
function Carlo.register_evaluables(
::Type{YourMC},
eval::Evaluator,
params::AbstractDict,
)
T = params[:T]
Lx = params[:Lx]
Ly = get(params, :Ly, Lx)
evaluate!(eval, :Susceptibility, (:Magnetization2,)) do mag2
return Lx * Ly * mag2 / T
end
evaluate!(eval, :BinderRatio, (:Magnetization2, :Magnetization4)) do mag2, mag4
return mag2 * mag2 / mag4
end
return nothing
end
```

Note that this code is called after the simulation is over, so there is no way to access the simulation state. However, it is possible to get the needed information about the system (e.g. temperature, system size) from the task parameters `params`

.