File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,9 @@ void Init_symengine() {
125125 c_zeta = rb_define_class_under(m_symengine, "Zeta", c_function);
126126 c_gamma = rb_define_class_under(m_symengine, "Gamma", c_function);
127127
128+ //Abs Class
129+ c_abs = rb_define_class_under(m_symengine, "Abs", c_function);
130+
128131 //TrigFunction SubClasses
129132 c_sin = rb_define_class_under(m_symengine, "Sin", c_trig_function);
130133 c_cos = rb_define_class_under(m_symengine, "Cos", c_trig_function);
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ VALUE c_lambertw;
2727VALUE c_dirichlet_eta;
2828VALUE c_zeta;
2929VALUE c_gamma;
30+ VALUE c_abs;
3031VALUE c_sin;
3132VALUE c_cos;
3233VALUE c_tan;
Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ VALUE Klass_of_Basic(const basic_struct *basic_ptr) {
113113 return c_mul;
114114 case SYMENGINE_POW:
115115 return c_pow;
116+ case SYMENGINE_ABS:
117+ return c_abs;
116118 case SYMENGINE_SIN:
117119 return c_sin;
118120 case SYMENGINE_COS:
Original file line number Diff line number Diff line change 22 let(:pi) { SymEngine::PI }
33 let(:e) { SymEngine::E }
44 let(:x) { sym("x") }
5+ let(:y) { sym("y") }
6+
7+ context "Abs" do
8+ context "with a symbol" do
9+ subject { SymEngine::abs(x)}
10+ it { is_expected.to be_a SymEngine::Abs }
11+ end
12+ context "with an integer" do
13+ subject { SymEngine::abs(SymEngine(1))}
14+ it { is_expected.to be_a SymEngine::Integer }
15+ end
16+ context "with a symbol addition" do
17+ subject { SymEngine::abs(x+y) }
18+ it { is_expected.to be_a SymEngine::Abs }
19+ end
20+ context "with a function of a symbol" do
21+ subject { SymEngine::abs(SymEngine::sin(x)) }
22+ it { is_expected.to be_a SymEngine::Abs }
23+ end
24+ end
525
626 context '2*x' do
727 [
You can’t perform that action at this time.
0 commit comments