LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
vector_calculus_extrema.hpp
浏览该文件的文档.
1#pragma once
2
4
5namespace LMCAS {
6
14
15/** @brief 临界点的坐标、分类及成立条件。 */
17 std::map<std::string, std::shared_ptr<SymbolicExpr>> point;
20 std::vector<std::shared_ptr<SymbolicExpr>> conditions;
21};
22
26
27/**
28 * @brief 求多元函数的极值点并分类。
29 *
30 * 求解 ∇f = 0,并按海森矩阵的特征值分类:
31 * - 所有特征值为正 → 局部极小值 (minimum)
32 * - 所有特征值为负 → 局部极大值 (maximum)
33 * - 特征值正负混合 → 鞍点 (saddle)
34 * - 海森矩阵奇异 → 退化点 (degenerate)
35 *
36 * @param[in] f 标量函数表达式
37 * @param[in] vars 变量名列表
38 * @return 临界点列表,每个包含坐标和分类
39 */
41 const std::shared_ptr<SymbolicExpr>& f,
42 const std::vector<std::string>& vars,
44
45/** @brief 使用默认计算上下文求极值点;无效输入和未覆盖域以错误返回。 */
47 const std::shared_ptr<SymbolicExpr>& f,
48 const std::vector<std::string>& vars);
49
50LMCAS_API std::vector<CriticalPoint> find_extrema(
51 const std::shared_ptr<SymbolicExpr>& f, const std::vector<std::string>& vars);
52
53/**
54 * @brief 使用拉格朗日乘数法求约束极值。
55 *
56 * 构造系统 ∇f = λ₁∇g₁ + λ₂∇g₂ + ... 并联合约束方程 gᵢ = 0 求解。
57 * 支持单个和多个等式约束。
58 *
59 * @param[in] f 目标函数表达式
60 * @param[in] constraints 约束列表(每个约束表达式等于零)
61 * @param[in] vars 变量名列表
62 * @return 所有临界点的列表,每个为变量名到值的映射(仅包含原始变量,不含乘数)
63 */
65 const std::shared_ptr<SymbolicExpr>& f,
66 const std::vector<std::shared_ptr<SymbolicExpr>>& constraints,
67 const std::vector<std::string>& vars,
69
70/** @brief 使用默认计算上下文求拉格朗日候选;无效输入和未覆盖域以错误返回。 */
72 const std::shared_ptr<SymbolicExpr>& f,
73 const std::vector<std::shared_ptr<SymbolicExpr>>& constraints,
74 const std::vector<std::string>& vars);
75
76LMCAS_API std::vector<std::map<std::string, std::shared_ptr<SymbolicExpr>>> lagrange_multipliers(
77 const std::shared_ptr<SymbolicExpr>& f,
78 const std::vector<std::shared_ptr<SymbolicExpr>>& constraints,
79 const std::vector<std::string>& vars);
80
81}
#define LMCAS_API
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
__attribute__((visibility("default"))) VectorCalculusFieldResult gradient_checked(const std __attribute__((visibility("default"))) VectorCalculusFieldResult gradient_checked(const std __attribute__((visibility("default"))) VectorField gradient(const std const std::vector< std::string > & vars
Result< std::vector< std::map< std::string, std::shared_ptr< SymbolicExpr > > > > LagrangeResult
LagrangeResult lagrange_multipliers_checked(const std::shared_ptr< SymbolicExpr > &f, const std::vector< std::shared_ptr< SymbolicExpr > > &constraints, const std::vector< std::string > &vars, ComputationContext &context)
ExtremaResult find_extrema_checked(const std::shared_ptr< SymbolicExpr > &f, const std::vector< std::string > &vars, ComputationContext &context)
Result< std::vector< CriticalPoint > > ExtremaResult
std::vector< CriticalPoint > find_extrema(const std::shared_ptr< SymbolicExpr > &f, const std::vector< std::string > &vars)
std::vector< std::map< std::string, std::shared_ptr< SymbolicExpr > > > lagrange_multipliers(const std::shared_ptr< SymbolicExpr > &f, const std::vector< std::shared_ptr< SymbolicExpr > > &constraints, const std::vector< std::string > &vars)
临界点的坐标、分类及成立条件。
std::vector< std::shared_ptr< SymbolicExpr > > conditions
CriticalPointClassification classification
std::map< std::string, std::shared_ptr< SymbolicExpr > > point