Math Expression
Overview
Use this skill when a natural-language math request should be translated into a single Wolfram Language expression and then evaluated or solved.
It fits symbolic algebra, calculus, exact arithmetic, high-precision numerics, matrix problems, series, asymptotics, and ODE/PDE tasks. It does not replace a general code executor or a multi-step notebook workflow.
Quick start
CODEBLOCK0
Safety boundary
- - Use this skill for math-only Wolfram Language expressions.
- By default, the script blocks filesystem, network, and process-related symbols such as
Import, URLRead, Run, RunProcess, Get, Put, OpenRead, and OpenWrite. - Do not disable this guard unless the runtime is isolated.
- This skill is not a general code execution tool and not a multi-step notebook agent.
Workflow
- 1. Convert the user's request into one Wolfram Language expression.
- Check that the expression is math-only.
- Run INLINECODE8
- Return
Exact, Numeric, Verified, and Version.
Examples
- - Algebraic simplification: INLINECODE13
- Definite integral: INLINECODE14
- Limit: INLINECODE15
- ODE analytic solution: INLINECODE16
- PDE numeric solution: INLINECODE17
- Asymptotic expansion: INLINECODE18
- High-precision value: INLINECODE19
Notes
- - Input is Wolfram Language only.
- This skill is single-expression and single-run.
- Runtime dependency:
wolframclient and WolframKernel.
数学表达式
概述
当需要将自然语言描述的数学请求转换为单个Wolfram语言表达式并进行求值或求解时,使用此技能。
它适用于符号代数、微积分、精确算术、高精度数值计算、矩阵问题、级数、渐近分析以及常微分方程/偏微分方程任务。它不能替代通用代码执行器或多步骤笔记本工作流。
快速开始
bash
python3 -m pip install --user wolframclient
python3 {baseDir}/scripts/eval_expression.py --expr Factor[x^4 - 1]
python3 {baseDir}/scripts/eval_expression.py --expr DSolve[y[x] + y[x] == 0, y[x], x]
python3 {baseDir}/scripts/eval_expression.py --expr N[Pi, 80] --precision 80 --json
安全边界
- - 仅将此技能用于纯数学的Wolfram语言表达式。
- 默认情况下,脚本会阻止文件系统、网络和进程相关的符号,如Import、URLRead、Run、RunProcess、Get、Put、OpenRead和OpenWrite。
- 除非运行时环境处于隔离状态,否则不要禁用此保护机制。
- 此技能不是通用代码执行工具,也不是多步骤笔记本代理。
工作流程
- 1. 将用户的请求转换为一个Wolfram语言表达式。
- 检查该表达式是否仅涉及数学运算。
- 运行scripts/eval_expression.py --expr ...
- 返回Exact、Numeric、Verified和Version。
示例
- - 代数化简:Factor[x^4 - 1]
- 定积分:Integrate[x^2 Exp[-x], {x, 0, Infinity}]
- 极限:Limit[(Sin[x] - x)/x^3, x -> 0]
- 常微分方程解析解:DSolve[y[x] + y[x] == 0, y[x], x]
- 偏微分方程数值解:NDSolve[{D[u[x, t], t] == D[u[x, t], {x, 2}], u[0, t] == 0, u[1, t] == 0, u[x, 0] == Sin[Pi x]}, u, {x, 0, 1}, {t, 0, 1}]
- 渐近展开:Asymptotic[LogGamma[x], x -> Infinity, 5]
- 高精度数值:N[Pi, 120]
注意事项
- - 输入仅限Wolfram语言。
- 此技能为单表达式单次运行。
- 运行时依赖:wolframclient和WolframKernel。