-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
%% Copyright (C) 2016 Lagu | ||
%% | ||
%% This file is part of OctSymPy. | ||
%% | ||
%% OctSymPy is free software; you can redistribute it and/or modify | ||
%% it under the terms of the GNU General Public License as published | ||
%% by the Free Software Foundation; either version 3 of the License, | ||
%% or (at your option) any later version. | ||
%% | ||
%% This software is distributed in the hope that it will be useful, | ||
%% but WITHOUT ANY WARRANTY; without even the implied warranty | ||
%% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
%% the GNU General Public License for more details. | ||
%% | ||
%% You should have received a copy of the GNU General Public | ||
%% License along with this software; see the file COPYING. | ||
%% If not, see <http://www.gnu.org/licenses/>. | ||
|
||
%% -*- texinfo -*- | ||
%% @documentencoding UTF-8 | ||
%% @defmethod @@sym binterval (@var{x}) | ||
%% Return the union of intervals of y when, @var{x} is in rectangular form | ||
%% or the union of intervals of theta when self is in polar form. | ||
%% | ||
%% Example: | ||
%% @example | ||
%% @group | ||
%% a = interval (sym (2), 3); | ||
%% b = interval (sym (4), 5); | ||
%% binterval (complexregion (a * b)) | ||
%% @result{} ans = (sym) [4, 5] | ||
%% @end group | ||
%% @end example | ||
%% | ||
%% @example | ||
%% @group | ||
%% c = interval (sym (1), 7); | ||
%% binterval (complexregion (a * b + b * c)) | ||
%% @result{} ans = (sym) [1, 7] | ||
%% @end group | ||
%% @end example | ||
%% | ||
%% @end defmethod | ||
|
||
|
||
function y = binterval(x) | ||
if (nargin ~= 1) | ||
print_usage (); | ||
end | ||
y = python_cmd ('return _ins[0].b_interval,', sym (x)); | ||
end | ||
|
||
|
||
%!test | ||
%! a = interval (sym (1), 2); | ||
%! b = interval (sym (4), 5); | ||
%! k = binterval (complexregion (a * b)); | ||
%! assert (isequal (k, b)) | ||
|
||
%!test | ||
%! a = interval (sym (1), 2); | ||
%! b = interval (sym (4), 5); | ||
%! c = interval (sym (-3), 2); | ||
%! k = binterval (complexregion (a * b + b * c)); | ||
%! assert (isequal (k, b + c)) |