Skip to content

Commit 8db86d8

Browse files
committed
add boundary
fix boundary doctest
1 parent 3aaa5f0 commit 8db86d8

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

inst/@sym/boundary.m

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
%% Copyright (C) 2016 Lagu
2+
%%
3+
%% This file is part of OctSymPy.
4+
%%
5+
%% OctSymPy is free software; you can redistribute it and/or modify
6+
%% it under the terms of the GNU General Public License as published
7+
%% by the Free Software Foundation; either version 3 of the License,
8+
%% or (at your option) any later version.
9+
%%
10+
%% This software is distributed in the hope that it will be useful,
11+
%% but WITHOUT ANY WARRANTY; without even the implied warranty
12+
%% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13+
%% the GNU General Public License for more details.
14+
%%
15+
%% You should have received a copy of the GNU General Public
16+
%% License along with this software; see the file COPYING.
17+
%% If not, see <http://www.gnu.org/licenses/>.
18+
19+
%% -*- texinfo -*-
20+
%% @documentencoding UTF-8
21+
%% @defmethod @@sym boundary (@var{x})
22+
%% The boundary or frontier of a set.
23+
%%
24+
%% Example:
25+
%% @example
26+
%% @group
27+
%% a = interval (sym (1), 2);
28+
%% b = interval (sym (5), 8);
29+
%% boundary (a + b)
30+
%% @result{} ans = (sym) @{1, 2, 5, 8@}
31+
%% @end group
32+
%% @end example
33+
%%
34+
%% @end defmethod
35+
36+
37+
function y = boundary(x)
38+
if (nargin ~= 1)
39+
print_usage ();
40+
end
41+
y = python_cmd ('return _ins[0].boundary,', sym (x));
42+
end
43+
44+
45+
%!test
46+
%! a = interval (sym (0), 1);
47+
%! b = interval (sym (0), 1, true, false);
48+
%! assert( isequal( boundary (a), boundary (b)))

0 commit comments

Comments
 (0)