本文整理汇总了C++中SymEngine::div方法的典型用法代码示例。如果您正苦于以下问题:C++ SymEngine::div方法的具体用法?C++ SymEngine::div怎么用?C++ SymEngine::div使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymEngine
的用法示例。
在下文中一共展示了SymEngine::div方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: R1
double R1()
{
RCP<const Basic> g;
RCP<const Basic> h = div(I, integer(2));
auto t1 = std::chrono::high_resolution_clock::now();
g = expand(f(f(f(f(f(f(f(f(f(f(h)))))))))));
auto t2 = std::chrono::high_resolution_clock::now();
return std::chrono::duration_cast<std::chrono::nanoseconds>(t2-t1).count()/1000000000.0;
}
示例2: A
double A()
{
auto t1 = std::chrono::high_resolution_clock::now();
for (int i = 1; i <= 100; i++) {
div(factorial(1000 + i), factorial(900 + i));
}
auto t2 = std::chrono::high_resolution_clock::now();
return std::chrono::duration_cast<std::chrono::nanoseconds>(t2-t1).count()/1000000000.0;
}
示例3: E
double E()
{
RCP<const Basic> s = integer(0);
RCP<const Basic> y = symbol("y");
RCP<const Basic> t = symbol("t");
auto t1 = std::chrono::high_resolution_clock::now();
for (int i = 1; i <= 10; i++) {
s = add(s, div(mul(integer(i), mul(y, pow(t, integer(i)))),
pow(add(y, mul(integer(abs(5 - i)), t)), integer(i))));
}
auto t2 = std::chrono::high_resolution_clock::now();
return std::chrono::duration_cast<std::chrono::nanoseconds>(t2-t1).count()/1000000000.0;
}
示例4: add
RCP<const Basic> f(RCP<const Basic> z) {
return add(mul(sqrt(div(one, integer(3))), pow(z, integer(2))), div(I, integer(3)));
}
示例5: integer
using SymEngine::Subs;
using SymEngine::Derivative;
using SymEngine::function_symbol;
using SymEngine::I;
using SymEngine::real_double;
using SymEngine::complex_double;
TEST_CASE("test_printing(): printing", "[printing]")
{
RCP<const Basic> r, r1, r2;
RCP<const Integer> i = integer(-1);
RCP<const Symbol> x = symbol("x");
RCP<const Symbol> y = symbol("y");
RCP<const Symbol> z = symbol("z");
r = div(integer(12), pow(integer(196), div(integer(1), integer(2))));
REQUIRE(r->__str__() == "(3/49)*196**(1/2)");
r = mul(integer(12), pow(integer(196), div(integer(1), integer(2))));
REQUIRE(r->__str__() == "12*196**(1/2)");
r = mul(integer(23), mul(pow(integer(5), div(integer(1), integer(2))),
pow(integer(7), div(integer(1), integer(2)))));
REQUIRE(r->__str__() == "23*5**(1/2)*7**(1/2)");
r = mul(integer(2), pow(symbol("x"), integer(2)));
REQUIRE(r->__str__() == "2*x**2");
r = mul(integer(23), mul(pow(div(integer(5), integer(2)), div(integer(1), integer(2))),
pow(div(integer(7), integer(3)), div(integer(1), integer(2)))));
REQUIRE(r->__str__() == "23*(7/3)**(1/2)*(5/2)**(1/2)");