-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))" | ||
}; | ||
``` | ||
|