LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
transform_engine.hpp
浏览该文件的文档.
1/**
2 * @file transform_engine.hpp
3 * @brief 积分变换引擎:Laplace 变换,逆 Laplace 变换,Fourier 变换,Z 变换.
4 *
5 * 提供基于内置规则匹配,线性性质和位移定理的符号积分变换计算;
6 * 当前规则集之外的表达式由 checked API 返回 Inconclusive.
7 */
8#pragma once
9
12#include "result.hpp"
13#include "symbolic.hpp"
14#include <memory>
15#include <string>
16
17
18namespace LMCAS {
19
20
21/**
22 * @brief checked 变换仅返回已求值并认证的表达式。
23 * 条件与收敛域约束须在给定上下文假设下同时成立,并非全局已证事实。
24 * 支持范围未知或收敛域无法表示时返回 Inconclusive;资源与取消错误原样传播。
25 * 成功结果仅在保留的定义域内有效,规则集可不完备。
26 */
27
28
29
30/**
31 * @brief 计算函数的 Laplace 变换 L{f(t)} = F(s).
32 *
33 * 算法:
34 * 1. 线性性:L{af + bg} = aL{f} + bL{g}
35 * 2. 内置规则匹配:识别已支持的变换对(t^n, e^at, sin, cos, sinh, cosh)
36 * 3. 位移定理:L{e^(at)*f(t)} = F(s-a)
37 * 4. 当前规则集之外的表达式返回 Inconclusive
38 *
39 * 多项式次数与阶乘系数保持为精确 BigInt。
40 * 阶乘计算消耗上下文的步数和整数位数预算;耗尽时返回 checked 阶乘错误,保持精确语义。
41 *
42 * @param[in] f 时域函数表达式
43 * @param[in] t 时域变量名
44 * @param[in] s 频域变量名
45 * @return Laplace 变换结果 F(s)
46 */
48 const std::shared_ptr<SymbolicExpr>& f,
49 const std::string& t,
50 const std::string& s,
52
53/**
54 * @brief 使用默认计算上下文计算 Laplace 变换,并返回条件/ROC 容器.
55 */
57 const std::shared_ptr<SymbolicExpr>& f,
58 const std::string& t,
59 const std::string& s);
60
61/**
62 * @brief 计算逆 Laplace 变换 L-¹{F(s)} = f(t).
63 *
64 * 算法:
65 * 1. 线性性:L-¹{aF + bG} = aL-¹{F} + bL-¹{G}
66 * 2. 部分分式分解 F(s)
67 * 3. 对每个部分分式项查表求逆变换
68 * 4. 重极点处理:L-¹{1/(s-a)^n} = t^(n-1)*e^(at)/(n-1)!
69 * 5. 逆位移定理:L-¹{F(s-a)} = e^(at)*f(t)
70 * 6. 当前规则集之外的表达式返回 Inconclusive
71 *
72 * @param[in] F 频域函数表达式
73 * @param[in] s 频域变量名
74 * @param[in] t 时域变量名
75 * @return 逆 Laplace 变换结果 f(t)
76 */
78 const std::shared_ptr<SymbolicExpr>& F,
79 const std::string& s,
80 const std::string& t,
82
83/**
84 * @brief 使用默认计算上下文计算逆 Laplace 变换,并返回条件/ROC 容器.
85 */
87 const std::shared_ptr<SymbolicExpr>& F,
88 const std::string& s,
89 const std::string& t);
90
91
92/**
93 * @brief 计算函数的 Fourier 变换 F{f(t)} = F(omega).
94 *
95 * 指数衰减率须由上下文假设证明为实数;无约束符号参数须显式声明为实数。
96 * exp(-a*abs(t)) 的变换为 2*a/(a*a+omega*omega),保留所有与 t 无关的因子;
97 * a 的正性未知时附带 a > 0 条件。
98 * 已知非正、复数或实性未证的衰减率返回 Inconclusive。
99 * 线性组合与缩放保留各已求值项的条件。
100 * @param[in] f 时域函数表达式
101 * @param[in] t 时域变量名
102 * @param[in] omega 频域变量名
103 * @return Fourier 变换结果
104 */
106 const std::shared_ptr<SymbolicExpr>& f,
107 const std::string& t,
108 const std::string& omega,
110
111/**
112 * @brief 使用默认计算上下文计算 Fourier 变换,并返回条件/ROC 容器.
113 */
115 const std::shared_ptr<SymbolicExpr>& f,
116 const std::string& t,
117 const std::string& omega);
118
119/**
120 * @brief 计算逆 Fourier 变换 F-¹{F(omega)} = f(t).
121 * @param[in] F 频域函数表达式
122 * @param[in] omega 频域变量名
123 * @param[in] t 时域变量名
124 * @return 逆 Fourier 变换结果
125 */
127 const std::shared_ptr<SymbolicExpr>& F,
128 const std::string& omega,
129 const std::string& t,
131
132/**
133 * @brief 使用默认计算上下文计算逆 Fourier 变换,并返回条件/ROC 容器.
134 */
136 const std::shared_ptr<SymbolicExpr>& F,
137 const std::string& omega,
138 const std::string& t);
139
140/**
141 * @brief 计算两个函数的卷积 (f * g)(t) = integralf(tau)g(t-tau)dtau.
142 * @param[in] f 第一个函数
143 * @param[in] g 第二个函数
144 * @param[in] var 卷积变量名
145 * @return 卷积结果
146 */
148 const std::shared_ptr<SymbolicExpr>& f,
149 const std::shared_ptr<SymbolicExpr>& g,
150 const std::string& var,
152
153/**
154 * @brief 使用默认计算上下文计算卷积,并显式报告无效输入.
155 */
157 const std::shared_ptr<SymbolicExpr>& f,
158 const std::shared_ptr<SymbolicExpr>& g,
159 const std::string& var);
160
161
162/**
163 * @brief 计算序列的 Z 变换 Z{f[n]} = F(z).
164 * @param[in] f_n 序列通项表达式
165 * @param[in] n 序列指标变量名
166 * @param[in] z Z 域变量名
167 * @return Z 变换结果
168 */
170 const std::shared_ptr<SymbolicExpr>& f_n,
171 const std::string& n,
172 const std::string& z,
174
175/**
176 * @brief 使用默认计算上下文计算 Z 变换,并返回条件/ROC 容器.
177 */
179 const std::shared_ptr<SymbolicExpr>& f_n,
180 const std::string& n,
181 const std::string& z);
182
183} // namespace LMCAS
#define LMCAS_API
TransformEngineResult laplace_transform_checked(const std::shared_ptr< SymbolicExpr > &f, const std::string &t, const std::string &s, ComputationContext &context)
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
TransformEngineResult inverse_fourier_transform_checked(const std::shared_ptr< SymbolicExpr > &F, const std::string &omega, const std::string &t, ComputationContext &context)
TransformEngineResult convolve_checked(const std::shared_ptr< SymbolicExpr > &f, const std::shared_ptr< SymbolicExpr > &g, const std::string &var, ComputationContext &context)
Result< Verified< EvaluatedTransform > > TransformEngineResult
TransformEngineResult inverse_laplace_checked(const std::shared_ptr< SymbolicExpr > &F, const std::string &s, const std::string &t, ComputationContext &context)
TransformEngineResult z_transform_checked(const std::shared_ptr< SymbolicExpr > &f_n, const std::string &n, const std::string &z, ComputationContext &context)
TransformEngineResult fourier_transform_checked(const std::shared_ptr< SymbolicExpr > &f, const std::string &t, const std::string &omega, ComputationContext &context)
__attribute__((visibility("default"))) VectorCalculusExprResult curve_integral_scalar_checked(const std __attribute__((visibility("default"))) VectorCalculusExprResult curve_integral_scalar_checked(const std __attribute__((visibility("default"))) std const VectorField const std::string & t
符号表达式主类 SymbolicExpr 及其工厂方法,运算接口.