LMCAS
Lamina Computer Algebra System
Toggle main menu visibility
载入中...
搜索中...
未找到
mixed_transcendental_numeric.cpp
浏览该文件的文档.
1
#include "
internal/mixed_transcendental_support.hpp
"
2
#include "
internal/expression_transform.hpp
"
3
#include <new>
4
#include <stdexcept>
5
6
namespace
LMCAS::detail
{
7
8
/**
9
* @internal
10
* @brief 隔离并精化单个因子的数值根。
11
*
12
* 计算导数后用 isolate_roots 隔离根,再用 refine_root 逐根精化。
13
*
14
* @param[in] factor 待求解因子表达式
15
* @param[in] var 变量名
16
* @param[in] interval 搜索区间
17
* @param[in] opts 求解选项
18
* @return 精化后的数值根列表
19
*/
20
Result<std::vector<NumericRoot>
>
mixed_numerical_path
(
21
const
std::shared_ptr<SymbolicExpr>& factor,
22
const
std::string& var,
23
const
SearchInterval
&
interval
,
24
const
SolveOptions
& opts,
25
RewriteBudget
&
budget
,
26
bool
& complete)
27
{
28
std::vector<NumericRoot>
roots
;
29
std::shared_ptr<SymbolicExpr> derivative;
30
try
{
31
if
(factor &&
LMCAS::detail::node
(factor)) {
32
derivative =
make_expression_ptr
(
33
differentiate_node
(
node
(factor), var,
budget
));
34
}
35
}
catch
(
const
CasError
& error) {
36
if
(error.
code
!=
CasErrc::UnsupportedExpression
)
throw
;
37
complete =
false
;
38
}
39
complete =
false
;
40
std::optional<CasError> failure;
41
auto
intervals =
isolate_roots_with_context
(
42
factor, derivative, var,
interval
, opts,
43
budget
, &failure, &complete);
44
if
(failure) {
45
return
Result<std::vector<NumericRoot>
>::failure(*failure);
46
}
47
48
for
(
const
auto
& isolated : intervals) {
49
auto
refined =
refine_root_with_context
(
50
factor, derivative, var, isolated, opts,
51
budget
, &failure, &complete);
52
if
(failure) {
53
return
Result<std::vector<NumericRoot>
>::failure(*failure);
54
}
55
if
(refined) {
56
roots
.push_back(*refined);
57
}
58
}
59
return
Result<std::vector<NumericRoot>
>::success(std::move(
roots
));
60
}
61
62
}
LMCAS::Result
定义
result.hpp:39
LMCAS::detail::RewriteBudget
定义
rewrite_budget.hpp:15
expression_transform.hpp
mixed_transcendental_support.hpp
LMCAS::detail
多元 Hensel 提升(单变量步)
定义
assumption_context.hpp:31
LMCAS::detail::differentiate_node
SymbolicNodePtr differentiate_node(const SymbolicNodePtr &node, const std::string &variable, RewriteBudget &budget, const FactsQuery &facts, Domain domain)
定义
symbolic_core.cpp:233
LMCAS::detail::make_expression_ptr
std::shared_ptr<::LMCAS::SymbolicExpr > make_expression_ptr(SymbolicNodePtr root)
定义
base.hpp:111
LMCAS::detail::node
const SymbolicNodePtr & node(const ::LMCAS::SymbolicExpr &expression) noexcept
定义
base.hpp:91
LMCAS::detail::refine_root_with_context
std::optional< NumericRoot > refine_root_with_context(const std::shared_ptr< SymbolicExpr > &expr, const std::shared_ptr< SymbolicExpr > &derivative, const std::string &var, const IsolatedInterval &interval, const SolveOptions &opts, RewriteBudget &budget, std::optional< CasError > *failure, bool *complete)
定义
mixed_transcendental_refinement.cpp:199
LMCAS::detail::budget
RewriteBudget & budget
定义
expression_transform.hpp:16
LMCAS::detail::mixed_numerical_path
Result< std::vector< NumericRoot > > mixed_numerical_path(const std::shared_ptr< SymbolicExpr > &factor, const std::string &var, const SearchInterval &interval, const SolveOptions &opts, RewriteBudget &budget, bool &complete)
隔离并精化单个因子的数值根。
定义
mixed_transcendental_numeric.cpp:20
LMCAS::detail::isolate_roots_with_context
std::vector< IsolatedInterval > isolate_roots_with_context(const std::shared_ptr< SymbolicExpr > &expr, const std::shared_ptr< SymbolicExpr > &derivative, const std::string &var, const SearchInterval &interval, const SolveOptions &opts, RewriteBudget &budget, std::optional< CasError > *failure, bool *complete)
定义
mixed_transcendental_isolation.cpp:184
LMCAS::interval
ExprResult interval(ExprPtr lower, ExprPtr upper, bool lower_closed, bool upper_closed)
定义
expr_facade.cpp:168
LMCAS::CasErrc::UnsupportedExpression
@ UnsupportedExpression
定义
result.hpp:23
LMCAS::roots
ExprSetResult roots(const ExprPtr &expression, const std::string &variable, ComputationContext &context, const SolveOptions &options)
定义
expr_solving.cpp:80
LMCAS::CasError::code
CasErrc code
定义
result.hpp:32
LMCAS::SearchInterval
搜索区间
定义
solve_mixed_transcendental.hpp:25
LMCAS::SolveOptions
方程求解选项,控制数值求解行为和结果形式.
定义
solve_strategies.hpp:17
LMCAS::CasError
定义
result.hpp:31
src
mixed_transcendental_numeric.cpp
生成于
, 为 LMCAS使用
1.18.0