Math & Numbers
Newton-Raphson 迭代求根计算器
用 Newton-Raphson 迭代 x_{k+1} = x_k − f(x_k)/f'(x_k) 求 f(x) = 0 的根:导数可给定解析表达式(留空则用中心差分数值导数),输出逐步迭代表(x_k 与 f(x_k))、收敛判据(|f| < 容差或 |Δx| < 容差·max(1,|x|))、迭代次数与最终 |f(root)|。经典例:x²−2 从 x₀=1 出发 4 步收敛到 √2 ≈ 1.4142135624;cos(x)−x 收敛到 Dottie 数 0.7390851332。导数为零、步长发散或超出迭代上限会明确报告。
text· 文本结果打开工具
快速开始
用三种语言从你的代码中调用此工具。
cURL
curl -X POST 'https://api.elysiatools.com/zh/api/tools/newton-raphson-root-finder' \
-H 'Content-Type: application/json' \
-d '{"fxExpr":"x^2 - 2","dfxExpr":"","x0":1,"tolerance":1e-10,"maxIter":50,"decimalPlaces":10}'API 参考
以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
请求端点
HTTP
POST https://api.elysiatools.com/zh/api/tools/newton-raphson-root-finder请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| fxExpr | text | 是 | The function whose root is sought, in the variable x. Supports + - * / ^, parentheses, and functions like exp, sin, cos, sqrt, ln. |
| dfxExpr | text | 否 | Optional analytic derivative; when blank a central difference (h ≈ 1e-7) is used. |
| x0 | number | 否 | Starting point of the iteration. |
| tolerance | number | 否 | Convergence threshold on |f(x)| and on the step size. |
| maxIter | number | 否 |
MCP 集成
将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。
服务配置
将以下内容加入你的 MCP 客户端配置:
mcp.json
{
"mcpServers": {
"elysiatools-newton-raphson-root-finder": {
"name": "newton-raphson-root-finder",
"description": "用 Newton-Raphson 迭代 x_{k+1} = x_k − f(x_k)/f'(x_k) 求 f(x) = 0 的根:导数可给定解析表达式(留空则用中心差分数值导数),输出逐步迭代表(x_k 与 f(x_k))、收敛判据(|f| < 容差或 |Δx| < 容差·max(1,|x|))、迭代次数与最终 |f(root)|。经典例:x²−2 从 x₀=1 出发 4 步收敛到 √2 ≈ 1.4142135624;cos(x)−x 收敛到 Dottie 数 0.7390851332。导数为零、步长发散或超出迭代上限会明确报告。",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=newton-raphson-root-finder",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}列出可用工具
连接到 SSE 端点后,列出已开放的工具:
tools/list
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}调用此工具
通过工具 id 调用,参数由其参数表构建:
tools/call
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "newton-raphson-root-finder",
"arguments": {
"fxExpr": "x^2 - 2",
"dfxExpr": "",
"x0": 1,
"tolerance": 1e-10,
"maxIter": 50,
"decimalPlaces": 10
}
}
}可用逗号分隔的 toolId 在一个会话中串联多个工具,例如 /mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp(最多 20 个)。
有问题或反馈?请联系 [email protected]