> For the complete documentation index, see [llms.txt](https://cenit-finance-1.gitbook.io/generic-simulation-tool-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cenit-finance-1.gitbook.io/generic-simulation-tool-docs/advanced-editor/advanced-editor-workflow/simulation-equations.md).

# Simulation Equations

The dynamics of the simulation are defined through mathematical equations. Together they form a system that describes the evolution of the token economy simulation from timestep to timestep.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeJzTqgHyEUEa3aDxqeq251RoY1xzEUXAWnpTwbPm-h2JKFikcGEcvM8i3u_vB-Q0gF4aeI3lUU8X6o0ILsK42WmsKelU2lu-93IlnB0NpaFn3IZBZPsNdkWABoXYhox9of3CSJsetuTivQW7aWr6UOYoKL?key=gBdoBauPQRHBeCJCAQCSUw" alt=""><figcaption></figcaption></figure>

This table contains, at the bottom, a list of all the token exchange flows defined in the "Agents and Token Flows" tab. The objective is to define these token flows mathematically, with an equation that describes the number of tokens exchanged through that flow at each simulation timestep. We can define additional variables with their corresponding equations to help us calculate the token flows as intermediate steps.

The formulas in the equations can use references for other elements defined in previous sections:

**Input Parameters:**

* Static values: Use the reference of the parameter directly.
* Time-dependent parameters: Use the reference of the variable from the "Variables" section directly. At each timestep, the value will be that defined for that time for the parameter.
* Selector parameters: may be used with the following syntax: *{parameter\_reference}.case("{option1}": {formula1}, "{option2}": {formula2}...)*. For instance: *SE\_mode.case("Linear": X, "Quadratic": X^2).*

**Agents:** Some agent properties may be referenced using the syntax *{agent\_reference}.{property\_name}* (for instance, *A\_users.total\_tokens*):

* total\_tokens: full amount owned at this point in the simulation.
* liquidity\_provided\_tokens: total tokens provided as liquidity to the market by the agent at this point in the simulation.
* liquidity\_flow: change in the amount of tokens provided as liquidity to the market by the agent in the current timestep.

**Other Variables:** You can reference the result from another equation in this table using the reference of the variable.

**Special Variables:** There are some special variables always defined and available to reference:

* *time* and *timestep*: the current time and timestep of the simulation. The units are in seconds by default, but it is possible to use modifiers like *time.seconds, time.hours, time.days, time.months, time.years* to reference them with different units.
* *token\_price*: price of the token in USD.
* *circulating\_supply*: current amount of tokens in circulation.
* *total\_supply*: total amount of tokens in existence (circulating supply + tokens still locker in vesting schedules).

Additionally, you may use the special modifier *.previous* to reference the value of a variable from the previous timestep. For exampl&#x65;*, token\_price.previous.*

Equations must avoid circular dependencies, such as an equation referencing its own result. Most circular dependencies can be resolved by approximating a variable dependence in a formula by referencing the value from the previous step using .previous.

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cenit-finance-1.gitbook.io/generic-simulation-tool-docs/advanced-editor/advanced-editor-workflow/simulation-equations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
