Skip to content

Commit

Permalink
qsp-function description
Browse files Browse the repository at this point in the history
  • Loading branch information
metelkin committed Nov 25, 2024
1 parent e27871c commit c285f63
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 8 deletions.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@

To read the full documentation, visit the Heta project homepage: <https://hetalang.github.io/#/heta-compiler/>.

See also:

- [Migrate to v0.6](./migrate-to-v0.6);
- [Migrate to v0.7](./migrate-to-v0.7);
- [Migrate to v0.8](./migrate-to-v0.8);
- [Migrate to v0.9](./migrate-to-v0.9).

## Table of contents
## General information

- [Introduction](#introduction)
- [How to cite](#how-to-cite)
Expand All @@ -34,6 +27,22 @@ See also:
- [License](#license)
- [Authors and history](#authors-and-history)

## Additional information

- [Export formats](./export-formats)
- [CLI references](./cli-references)
- [qsp-functions.heta](./qsp-functions.heta)
- [qsp-units.heta](./qsp-units.heta)
- [API docs](https://hetalang.github.io/heta-compiler/dev)
- [Changelog](./CHANGELOG.md)

## Migration from previous versions

- [Migrate to v0.6](./migrate-to-v0.6);
- [Migrate to v0.7](./migrate-to-v0.7);
- [Migrate to v0.8](./migrate-to-v0.8);
- [Migrate to v0.9](./migrate-to-v0.9).

## Introduction

**Heta compiler** is a tool for the development of Quantitative Systems Pharmacology and Systems Biology platforms. It allows combining modules written in different formats like: [Heta language code](https://hetalang.github.io/#/specifications/), Excel sheets, [JSON](https://en.wikipedia.org/wiki/JSON)/[YAML](https://en.wikipedia.org/wiki/YAML) formatted structures, [SBML](http://sbml.org/) and transforming them into the dynamical model/models of different formats.
Expand Down
96 changes: 96 additions & 0 deletions qsp-functions.heta.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# `qsp-functions.heta`

The `qsp-functions.heta` file serves as a container for additional custom functions that can be used within Heta platforms.

## Overview

- **Location:** This file is automatically generated when you run the `heta init` command and can be found in the `src` directory of your project.
- **Integration:** A reference to this file is included in the `index.heta` file, ensuring these functions are available within your Heta project.

## Defining Custom Functions

Heta provides the flexibility to define your own functions. For details on how to create custom functions, refer to the [`#defineFunction`](https://hetalang.github.io/#/specifications/actions?id=definefunction) specification.

## Included Functions

The `qsp-functions.heta` file contains a curated list of additional functions specifically tailored for Heta platforms. These functions are not part of the [base function list](https://hetalang.github.io/#/specifications/math?id=list-of-functions), but they extend the platform's functionality.

## Best Practices

2. Organize new functions in dedicated files or include them in the main `index.heta` for better maintainability.
3. Keep the `qsp-functions.heta` file intact to ensure a consistent and predictable setup for your project.

## Content

```heta
/*
Additional functions which can be used in Heta platforms
can be added to index file by include ./qsp-functions.heta;
*/
// hyperbolic functions
#defineFunction sinh {
arguments: [x],
math: "0.5 * (exp(x) - exp(-x))"
};
#defineFunction cosh {
arguments: [x],
math: "0.5 * (exp(x) + exp(-x))"
};
#defineFunction tanh {
arguments: [x],
math: "(exp(2 * x) - 1) / (exp(2 * x) + 1)"
};
#defineFunction sech {
arguments: [x],
math: "1 / cosh(x)"
};
#defineFunction csch {
arguments: [x],
math: "1 / sinh(x)"
};
#defineFunction coth {
arguments: [x],
math: "1 / tanh(x)"
};
// inverse hyperbolic functions
#defineFunction arcsinh {
arguments: [x],
math: "ln(x + sqrt(x^2 + 1))"
};
#defineFunction arccosh {
arguments: [x],
math: "ln(x + sqrt(x^2 - 1))"
};
#defineFunction arctanh {
arguments: [x],
math: "0.5 * ln((1 + x) / (1 - x))"
};
#defineFunction arcsech {
arguments: [x],
math: "ln((1 + sqrt(1 - x^2)) / x)"
};
#defineFunction arccsch {
arguments: [x],
math: "ln(1 / x + sqrt(1 + 1 / x^2))"
};
#defineFunction arccoth {
arguments: [x],
math: "0.5 * ln((x + 1) / (x - 1))"
};
```

0 comments on commit c285f63

Please sign in to comment.