> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/text-and-number/math-execution.md).

# 数学执行

数学执行是指用来进行基本数学运算（如加 `+`、减 `-`、乘 `*`、除 `/`）或从现有变量中计算复杂的数学表达式，然后将结果存储到一个输出变量中。

#### 配置参数：

* 表达式 (Expression): 需要执行的数学运算内容。您可以结合具体数字和现有变量（例如：`(5 + 3) * 2` 或者 `$price * $quantity`）。
* 输出变量: 用于存储计算完成后结果的变量名称。

#### 实际示例 1: 计算订单总金额（乘法和加法）

假设您正在编写自动购买脚本或抓取订单数据。您有产品数量变量 `$quantity = 3`，单价变量 `$price = 150000`，以及固定运费 `30000`。

* 配置方式：
  * 表达式: 填写表达式 `($price * $quantity) + 30000`
  * 输出变量: 填写存储结果的变量名称 `$totalAmount`。
* 结果: 系统将计算出值为 `480000` 并赋值给变量 `$totalAmount`。


---

# 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://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/text-and-number/math-execution.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.
