LMCAS
Lamina Computer Algebra System
Toggle main menu visibility
载入中...
搜索中...
未找到
query_special_values.cpp
浏览该文件的文档.
1
#include "
internal/query_support.hpp
"
2
3
namespace
LMCAS
{
4
5
6
bool
QueryInterface::is_unhandled_type(
const
SymbolicExpr& expression)
const
{
7
const
auto
&
node
=
LMCAS::detail::node
(expression);
8
if
(!node)
return
true
;
9
if
(std::dynamic_pointer_cast<const MatrixNode>(node))
return
true
;
10
if
(std::dynamic_pointer_cast<const RelationalNode>(node))
return
true
;
11
if
(std::dynamic_pointer_cast<const LogicalNode>(node))
return
true
;
12
return
false
;
13
}
14
15
bool
QueryInterface::is_infinity_node(
const
SymbolicExpr& expression)
const
{
16
const
auto
&
node
=
LMCAS::detail::node
(expression);
17
if
(
auto
func = std::dynamic_pointer_cast<const FunctionNode>(node)) {
18
return
func->type() ==
FunctionNode::FuncType::Infinity
;
19
}
20
if
(
auto
mul
= std::dynamic_pointer_cast<const MultiplyNode>(node)) {
21
if
(
mul
->operands().size() == 2) {
22
for
(
const
auto
&
op
:
mul
->operands()) {
23
if
(
auto
func = std::dynamic_pointer_cast<const FunctionNode>(
op
)) {
24
if
(func->type() ==
FunctionNode::FuncType::Infinity
) {
25
return
true
;
26
}
27
}
28
}
29
}
30
}
31
return
false
;
32
}
33
34
int
QueryInterface::get_infinity_sign(
const
SymbolicExpr& expression)
const
{
35
const
auto
&
node
=
LMCAS::detail::node
(expression);
36
if
(
auto
func = std::dynamic_pointer_cast<const FunctionNode>(node)) {
37
if
(func->type() ==
FunctionNode::FuncType::Infinity
) {
38
return
+1;
39
}
40
}
41
if
(
auto
mul
= std::dynamic_pointer_cast<const MultiplyNode>(node)) {
42
bool
has_infinity
=
false
;
43
bool
has_neg_one =
false
;
44
for
(
const
auto
&
op
:
mul
->operands()) {
45
if
(
auto
func = std::dynamic_pointer_cast<const FunctionNode>(
op
)) {
46
if
(func->type() ==
FunctionNode::FuncType::Infinity
) {
47
has_infinity
=
true
;
48
}
49
}
50
const
auto
number =
51
std::dynamic_pointer_cast<const NumberNode>(
op
);
52
if
(number && number->is_negative_one()) has_neg_one =
true
;
53
}
54
if
(has_infinity && has_neg_one)
return
-1;
55
if
(has_infinity)
return
+1;
/** @brief 无穷与正因子相乘仍为正无穷。 */
56
}
57
return
0;
/** @brief 符号未定。 */
58
}
59
60
}
LMCAS::FunctionNode::FuncType::Infinity
@ Infinity
无穷大。
定义
functions.hpp:20
LMCAS::anonymous_namespace{limit_result.cpp}::has_infinity
bool has_infinity(const NodePtr &node)
定义
limit_result.cpp:35
LMCAS::detail::node
const SymbolicNodePtr & node(const ::LMCAS::SymbolicExpr &expression) noexcept
定义
base.hpp:91
LMCAS
定义
assumption.hpp:11
LMCAS::mul
ExprResult mul(const ExprPtr &lhs, const ExprPtr &rhs, ComputationContext &context)
定义
expr_arithmetic.cpp:29
LMCAS::op
const ExprPtr RelationOp op
定义
expr.hpp:151
query_support.hpp
src
query_special_values.cpp
生成于
, 为 LMCAS使用
1.18.0