commit octave-forge-symbolic for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package octave-forge-symbolic for openSUSE:Factory checked in at 2023-10-31 20:25:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/octave-forge-symbolic (Old) and /work/SRC/openSUSE:Factory/.octave-forge-symbolic.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "octave-forge-symbolic" Tue Oct 31 20:25:34 2023 rev:13 rq:1121342 version:3.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/octave-forge-symbolic/octave-forge-symbolic.changes 2022-09-15 22:59:27.237260040 +0200 +++ /work/SRC/openSUSE:Factory/.octave-forge-symbolic.new.17445/octave-forge-symbolic.changes 2023-10-31 20:25:48.286171461 +0100 @@ -1,0 +2,15 @@ +Mon Oct 30 16:01:19 UTC 2023 - Atri Bhattacharya <badshah400@gmail.com> + +- Update URL to point to 'https://gnu-octave.github.io/packages/' + +------------------------------------------------------------------- +Thu Oct 19 09:00:05 UTC 2023 - Atri Bhattacharya <badshah400@gmail.com> + +- Update to version 3.1.1: + * New symbolic commands: cart2pol, piecewise + * `kron` works for three or more inputs (issue #1245). + * Indexing bounds checking to support Octave 8. + * Fix assumptions on SymPy 1.12. + * Other misc fixes and changes for SymPy 1.12. + +------------------------------------------------------------------- Old: ---- symbolic-3.0.1.tar.gz New: ---- symbolic-3.1.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ octave-forge-symbolic.spec ++++++ --- /var/tmp/diff_new_pack.PLA5Wc/_old 2023-10-31 20:25:49.134202610 +0100 +++ /var/tmp/diff_new_pack.PLA5Wc/_new 2023-10-31 20:25:49.134202610 +0100 @@ -1,7 +1,7 @@ # # spec file for package octave-forge-symbolic # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,12 +18,12 @@ %define octpkg symbolic Name: octave-forge-%{octpkg} -Version: 3.0.1 +Version: 3.1.1 Release: 0 Summary: Octave Symbolic Package using SymPy License: GPL-3.0-or-later Group: Productivity/Scientific/Math -URL: https://octave.sourceforge.io/%{octpkg}/ +URL: https://gnu-octave.github.io/packages/%{octpkg}/ Source0: https://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz BuildArch: noarch BuildRequires: octave-devel ++++++ symbolic-3.0.1.tar.gz -> symbolic-3.1.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/DESCRIPTION new/symbolic-3.1.1/DESCRIPTION --- old/symbolic-3.0.1/DESCRIPTION 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/DESCRIPTION 2023-03-19 19:05:57.000000000 +0100 @@ -1,6 +1,6 @@ Name: symbolic -Version: 3.0.1 -Date: 2022-08-09 +Version: 3.1.1 +Date: 2023-03-19 Author: Colin B. Macdonald <cbm@m.fsf.org> Maintainer: Colin B. Macdonald <cbm@m.fsf.org> Title: Octave Symbolic Package using SymPy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/INDEX new/symbolic-3.1.1/INDEX --- old/symbolic-3.0.1/INDEX 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/INDEX 2023-03-19 19:05:57.000000000 +0100 @@ -73,6 +73,7 @@ @sym/bessely @sym/besselyn @sym/beta + @sym/cart2pol @sym/cbrt @sym/ceil @sym/charpoly @@ -181,6 +182,7 @@ @sym/numden @sym/orth @sym/partfrac + @sym/piecewise @sym/pinv @sym/pochhammer @sym/polylog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/NEWS new/symbolic-3.1.1/NEWS --- old/symbolic-3.0.1/NEWS 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/NEWS 2023-03-19 19:05:57.000000000 +0100 @@ -1,3 +1,21 @@ +octsympy 3.1.1 (2023-03-19) +=========================== + + * New symbolic commands: + + cart2pol + piecewise + + * `kron` works for three or more inputs (issue #1245). + + * Indexing bounds checking to support Octave 8. + + * Fix assumptions on SymPy 1.12. + + * Other misc fixes and changes for SymPy 1.12. + + + octsympy 3.0.1 (2022-08-09) =========================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@double/bernoulli.m new/symbolic-3.1.1/inst/@double/bernoulli.m --- old/symbolic-3.0.1/inst/@double/bernoulli.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@double/bernoulli.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,4 +1,4 @@ -%% Copyright (C) 2018-2019, 2022 Colin B. Macdonald +%% Copyright (C) 2018-2019, 2022-2023 Colin B. Macdonald %% %% This file is part of OctSymPy. %% @@ -32,6 +32,19 @@ %% @end group %% @end example %% +%% Note there are two conventions in the literature about the sign of B_1, +%% but for certain the absolute value is one half: +%% @example +%% @group +%% @c Would render with an extra zero on earlier Octave +%% @c doctest: +SKIP_IF(compare_versions (OCTAVE_VERSION(), '6.0.0', '<')) +%% abs (bernoulli (1)) +%% @result{} 0.5000 +%% @end group +%% @end example +%% As of 2023, this numerical evaluation function is in a state of flux +%% about which one it takes, @pxref{@@sym/bernoulli}. +%% %% Polynomial example: %% @example %% @group @@ -85,7 +98,14 @@ %!assert (bernoulli (0), 1) %!assert (bernoulli (3), 0) -%!assert (bernoulli (1), -0.5, -eps) + +%!test +%! % two different definitions in literature +%! assert (abs (bernoulli (1)), 0.5, -eps) + +%!xtest +%! % we want to use B_1 = 1/2, possible with a version-specific filter +%! assert (bernoulli (1), 0.5, -eps) %!test %! n = sym(88); @@ -95,7 +115,7 @@ %! assert (A, B, -eps); %!test -%! m = [0 1; 2 4]; +%! m = [0 2; 3 4]; %! n = sym(m); %! A = bernoulli (m); %! B = double (bernoulli (n)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/atan2.m new/symbolic-3.1.1/inst/@sym/atan2.m --- old/symbolic-3.0.1/inst/@sym/atan2.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/atan2.m 2023-03-19 19:05:57.000000000 +0100 @@ -37,8 +37,6 @@ %% @seealso{@@sym/atan, @@sym/hypot} %% @end defmethod -%% Author: Colin B. Macdonald -%% Keywords: symbolic function a = atan2(y, x) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/bernoulli.m new/symbolic-3.1.1/inst/@sym/bernoulli.m --- old/symbolic-3.0.1/inst/@sym/bernoulli.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/bernoulli.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,4 +1,4 @@ -%% Copyright (C) 2014-2016, 2018-2019, 2022 Colin B. Macdonald +%% Copyright (C) 2014-2016, 2018-2019, 2022-2023 Colin B. Macdonald %% %% This file is part of OctSymPy. %% @@ -22,12 +22,33 @@ %% @deftypemethodx @@sym {@var{p} =} bernoulli (@var{n}, @var{x}) %% Return symbolic Bernoulli numbers or Bernoulli polynomials. %% -%% Examples: +%% With a sufficiently recent SymPy version, the first seven +%% Bernoulli numbers are: %% @example %% @group -%% bernoulli(sym(6)) +%% @c doctest: +XFAIL_IF(pycall_sympy__ ('return Version(spver) < Version("1.12.dev")')) +%% bernoulli (sym(0:6)) +%% @result{} (sym) [1 1/2 1/6 0 -1/30 0 1/42] (1×7 matrix) +%% @end group +%% @end example +%% +%% Note there are two different definitions in use which differ +%% in the sign of the value of B_1. As of 2023 and a sufficiently +%% recent SymPy library, we use the definition with positive one half: +%% @example +%% @group +%% @c doctest: +XFAIL_IF(pycall_sympy__ ('return Version(spver) < Version("1.12.dev")')) +%% bernoulli (sym(1)) +%% @result{} (sym) 1/2 +%% @end group +%% @end example +%% +%% Other examples: +%% @example +%% @group +%% bernoulli (sym(6)) %% @result{} (sym) 1/42 -%% bernoulli(sym(7)) +%% bernoulli (sym(7)) %% @result{} (sym) 0 %% @end group %% @end example @@ -36,7 +57,7 @@ %% @example %% @group %% syms x -%% bernoulli(2, x) +%% bernoulli (2, x) %% @result{} (sym) %% 2 1 %% x - x + ─ @@ -69,9 +90,19 @@ %! assert (isequal (bernoulli(3,x), x^3 - 3*x^2/2 + x/2)) %!test -%! m = sym([0 1; 8 888889]); +%! % two different definitions in literature +%! assert (isequal (abs (bernoulli (sym(1))), sym(1)/2)) + +%!test +%! % we use B_1 = 1/2 +%! if (pycall_sympy__ ('return Version(spver) >= Version("1.12.dev")')) +%! assert (isequal (bernoulli (sym(1)), sym(1)/2)) +%! end + +%!test +%! m = sym([0 2; 8 888889]); %! A = bernoulli (m); -%! B = [1 -sym(1)/2; -sym(1)/30 0]; +%! B = [1 sym(1)/6; -sym(1)/30 0]; %! assert (isequal (A, B)) %!test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/cart2pol.m new/symbolic-3.1.1/inst/@sym/cart2pol.m --- old/symbolic-3.0.1/inst/@sym/cart2pol.m 1970-01-01 01:00:00.000000000 +0100 +++ new/symbolic-3.1.1/inst/@sym/cart2pol.m 2023-03-19 19:05:57.000000000 +0100 @@ -0,0 +1,168 @@ +%% Copyright (C) 2022 Alex Vong +%% Copyright (C) 2022 Colin B. Macdonald +%% +%% 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 <https://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @documentencoding UTF-8 +%% @deftypemethod @@sym {[@var{theta}, @var{r}] =} cart2pol (@var{x}, @var{y}) +%% @deftypemethodx @@sym {[@var{theta}, @var{r}, @var{z}] =} cart2pol (@var{x}, @var{y}, @var{z}) +%% @deftypemethodx @@sym {[@var{theta}, @var{r}] =} cart2pol (@var{C}) +%% @deftypemethodx @@sym {[@var{theta}, @var{r}, @var{z}] =} cart2pol (@var{C}) +%% Transform symbolic Cartesian coordinates into polar or cylindrical. +%% +%% If called with inputs @var{x}, @var{y} (and @var{z}), they must be of the +%% same shape or a scalar. The shape of the outputs @var{theta}, @var{r} (and +%% @var{z}) matches those of the inputs (except when the input is a scalar). +%% +%% If called with a single input @var{C}, it must be a column vector with 2 or +%% 3 entries, or a matrix with 2 or 3 columns. The column vector or each row +%% of the matrix represents a point in Cartesian coordinates (@var{x}, @var{y}) +%% or (@var{x}, @var{y}, @var{z}). If input @var{C} is a column vector, +%% outputs @var{theta}, @var{r} (and @var{z}) is a scalar. Otherwise, the +%% shape of the outputs @var{theta}, @var{r} (and @var{z}) is a column vector +%% with each row corresponding to that of the input matrix @var{C}. +%% +%% Given a point (@var{x}, @var{y}) in Cartesian coordinates, its corresponding +%% polar coordinates can be obtained by: +%% @example +%% @group +%% syms x y real +%% [theta, r] = cart2pol (x, y) +%% @result{} theta = (sym) atan2(y, x) +%% r = (sym) +%% _________ +%% ╱ 2 2 +%% ╲╱ x + y +%% @end group +%% @end example +%% +%% Similarly, given a point (@var{x}, @var{y}, @var{z}) in Cartesian +%% coordinates, its corresponding cylindrical coordinates can be obtained by: +%% @example +%% @group +%% syms x y z real +%% [theta, r, z] = cart2pol (x, y, z) +%% @result{} theta = (sym) atan2(y, x) +%% r = (sym) +%% _________ +%% ╱ 2 2 +%% ╲╱ x + y +%% z = (sym) z +%% @end group +%% @end example +%% +%% @seealso{cart2pol} +%% @end deftypemethod + + +function [theta, r, z_out] = cart2pol (x_in, y_in, z_in) + %% obtain the kth column of matrix A + column_ref = @(A, k) subsref (A, substruct ('()', {':', k})); + + if nargin == 1 + C = sym (x_in); + sz = size (C); + nrows = sz(1); + ncols = sz(2); + if isequal (sz, [2 1]) + args = num2cell (C); + [theta, r] = cart2pol (args{:}); + elseif isequal (sz, [3 1]) + args = num2cell (C); + [theta, r, z_out] = cart2pol (args{:}); + elseif ncols == 2 + args = arrayfun (@(k) column_ref (C, k), 1:ncols, 'UniformOutput', false); + [theta, r] = cart2pol (args{:}); + elseif ncols == 3 + args = arrayfun (@(k) column_ref (C, k), 1:ncols, 'UniformOutput', false); + [theta, r, z_out] = cart2pol (args{:}); + else + warning ('cart2pol: C must be a column vector with 2 or 3 entries, or a matrix with 2 or 3 columns'); + print_usage (); + end + return + end + + x = sym (x_in); + y = sym (y_in); + if isscalar (size (x)) + sz = size (y); + elseif isscalar (size (y)) || isequal (size (x), size (y)) + sz = size (x); + else + error ('cart2pol: all inputs must have compatible sizes'); + end + r = hypot (sym (x), sym (y)); + theta = atan2 (sym (y), sym (x)); + + if nargin == 3 + z = sym (z_in); + if isscalar (z) + z_out = z * ones (sz); + elseif isequal(size (z), sz) + z_out = z; + else + error ('cart2pol: all inputs must have compatible sizes'); + end + end +end + + +%!test +%! % multiple non-scalar inputs +%! x = sym ('x', [2 2]); +%! assume (x, 'real'); +%! y = sym ('y', [2 2]); +%! assume (y, 'real'); +%! [theta, r] = cart2pol (x, y); +%! assert (isequal (r, sqrt (x.^2 + y.^2))); +%! assert (isequal (tan (theta), y ./ x)); +%! % mixing scalar inputs with non-scalar inputs +%! syms z real +%! [theta_2, r_2, z_2] = cart2pol (x, y, z); +%! assert (isequal (r_2, sqrt (x.^2 + y.^2))); +%! assert (isequal (tan (theta_2), y ./ x)); +%! assert (isequal (z_2, z * ones (2, 2))); + +%!test +%! % column vector with 2 entries +%! syms x y real +%! [theta, r] = cart2pol ([x; y]); +%! assert (isequal (r, sqrt (x.^2 + y.^2))); +%! assert (isequal (tan (theta), y ./ x)); +%! % column vector with 3 entries +%! syms z real +%! [theta_2, r_2, z_2] = cart2pol ([x; y; z]); +%! assert (isequal (r_2, sqrt (x.^2 + y.^2))); +%! assert (isequal (tan (theta_2), y ./ x)); +%! assert (isequal (z_2, z)); + +%!test +%! % matrix with 2 columns +%! syms x y u v real +%! C = [x y; u v]; +%! [theta, r] = cart2pol (C); +%! assert (isequal (r, [sqrt(x.^2+y.^2); sqrt(u.^2+v.^2)])); +%! assert (isequal (tan (theta), [y/x; v/u])); +%! % matrix with 3 columns +%! syms z w real +%! C_2 = [x y z; u v w]; +%! [theta_2, r_2, z_2] = cart2pol (C_2); +%! assert (isequal (r, [sqrt(x.^2+y.^2); sqrt(u.^2+v.^2)])); +%! assert (isequal (tan (theta), [y/x; v/u])); +%! assert (isequal (z_2, [z; w])); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/cat.m new/symbolic-3.1.1/inst/@sym/cat.m --- old/symbolic-3.0.1/inst/@sym/cat.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/cat.m 2023-03-19 19:05:57.000000000 +0100 @@ -40,8 +40,6 @@ %% @seealso{@@sym/vertcat, @@sym/horzcat} %% @end defmethod -%% Author: Colin B. Macdonald -%% Keywords: symbolic function z = cat(dim, varargin) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/conj.m new/symbolic-3.1.1/inst/@sym/conj.m --- old/symbolic-3.0.1/inst/@sym/conj.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/conj.m 2023-03-19 19:05:57.000000000 +0100 @@ -62,8 +62,6 @@ %% @seealso{@@sym/ctranspose, @@sym/real, @@sym/imag} %% @end defmethod -%% Author: Colin B. Macdonald -%% Keywords: symbolic function z = conj(x) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/divergence.m new/symbolic-3.1.1/inst/@sym/divergence.m --- old/symbolic-3.0.1/inst/@sym/divergence.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/divergence.m 2023-03-19 19:05:57.000000000 +0100 @@ -69,8 +69,6 @@ %% @@sym/hessian} %% @end defmethod -%% Author: Colin B. Macdonald -%% Keywords: symbolic function g = divergence(f, x) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/euler.m new/symbolic-3.1.1/inst/@sym/euler.m --- old/symbolic-3.0.1/inst/@sym/euler.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/euler.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,4 +1,4 @@ -%% Copyright (C) 2017-2019, 2022 Colin B. Macdonald +%% Copyright (C) 2017-2019, 2022-2023 Colin B. Macdonald %% %% This file is part of OctSymPy. %% @@ -112,5 +112,14 @@ %! vpa('4270.98066989140286451493108809574')*1i; %! z = vpa (exp(1), 32) + vpa(pi, 32)/13*1i; %! B = euler (13, z); -%! relerr = double(abs((B - A)/A)); -%! assert (abs(relerr) < 2e-31); +%! relerr = abs(double(abs((B - A)/A))); +%! assert (relerr < 20*eps); + +%!xtest +%! % as above, high-prec result broken in 1.12: https://github.com/sympy/sympy/issues/24156 +%! A = vpa('1623.14184180556920918624604530515') + ... +%! vpa('4270.98066989140286451493108809574')*1i; +%! z = vpa (exp(1), 32) + vpa(pi, 32)/13*1i; +%! B = euler (13, z); +%! relerr = abs(double(abs((B - A)/A))); +%! assert (relerr < 2e-31); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/ilaplace.m new/symbolic-3.1.1/inst/@sym/ilaplace.m --- old/symbolic-3.0.1/inst/@sym/ilaplace.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/ilaplace.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,5 +1,5 @@ %% Copyright (C) 2014-2016 Andrés Prieto -%% Copyright (C) 2015-2016, 2018-2019, 2022 Colin Macdonald +%% Copyright (C) 2015-2016, 2018-2019, 2022-2023 Colin Macdonald %% %% This file is part of OctSymPy. %% @@ -87,8 +87,6 @@ %% @seealso{@@sym/laplace} %% @end defmethod -%% Author: Colin B. Macdonald, Andrés Prieto -%% Keywords: symbolic, integral transforms function f = ilaplace(varargin) @@ -183,10 +181,18 @@ %!test %! % Delta dirac test 2 -%! syms s c -%! t = sym('t', 'positive'); -%! assert (isequal (ilaplace (5*exp(-3*s) + 2*exp(c*s) - 2*exp(-2*s)/s,t), ... -%! 5*dirac(t-3) + 2*dirac(c+t) - 2*heaviside(t-2))) +%! syms s t +%! calc = ilaplace (5*exp (-3*s) - 2*exp (-2*s)/s, s, t); +%! want = 5*dirac (t-3) - 2*heaviside (t-2); +%! assert (isequal (calc, want)) + +%!test +%! % Delta dirac test 3, coefficient +%! syms s t +%! syms c positive +%! calc = ilaplace (2*exp (-c*s), s, t); +%! want = 2*dirac (t - c); +%! assert (isAlways (calc == want)) %!error <more than one> ilaplace (sym('s', 'positive')*sym('s')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/jordan.m new/symbolic-3.1.1/inst/@sym/jordan.m --- old/symbolic-3.0.1/inst/@sym/jordan.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/jordan.m 2023-03-19 19:05:57.000000000 +0100 @@ -115,8 +115,6 @@ %% @seealso{@@sym/charpoly, @@sym/eig} %% @end deftypemethod -%% Author: Alex Vong -%% Keywords: symbolic function [V, J] = jordan (A) cmd = {'(A, calctrans) = _ins' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/kron.m new/symbolic-3.1.1/inst/@sym/kron.m --- old/symbolic-3.0.1/inst/@sym/kron.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/kron.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,5 +1,5 @@ %% Copyright (C) 2016 Utkarsh Gautam -%% Copyright (C) 2016, 2019 Colin B. Macdonald +%% Copyright (C) 2016, 2019, 2022 Colin B. Macdonald %% %% This file is part of OctSymPy. %% @@ -19,8 +19,9 @@ %% -*- texinfo -*- %% @documentencoding UTF-8 -%% @defmethod @@sym kron (@var{a}, @var{b}) -%% Kronecker tensor product of two matrices. +%% @defmethod @@sym kron (@var{a}, @var{b}) +%% @defmethodx @@sym kron (@var{a}, @var{b}, @dots{}, @var{c}) +%% Kronecker tensor product of two or more symbolic matrices. %% %% Examples: %% @example @@ -52,25 +53,43 @@ %% %% @end group %% @end example +%% +%% @example +%% @group +%% kron([1, 2], [x, y; y, x], [1; 7]) +%% @result{} ans = (sym 4×4 matrix) +%% +%% ⎡ x y 2⋅x 2⋅y ⎤ +%% ⎢ ⎥ +%% ⎢7⋅x 7⋅y 14⋅x 14⋅y⎥ +%% ⎢ ⎥ +%% ⎢ y x 2⋅y 2⋅x ⎥ +%% ⎢ ⎥ +%% ⎣7⋅y 7⋅x 14⋅y 14⋅x⎦ +%% +%% @end group +%% @end example %% @end defmethod -%% Author: Utkarsh Gautam -%% Keywords: kron product +function c = kron (varargin) -function c = kron (a, b) + if (nargin < 2) + print_usage (); + end - if (isscalar (a) || isscalar (b)) - c = a*b; - else - cmd = { 'a, b = _ins' - 'from sympy.physics.quantum import TensorProduct' - 'return TensorProduct(Matrix(a), Matrix(b))' - }; - c = pycall_sympy__ (cmd, sym(a), sym(b)); + for i = 1:nargin + varargin{i} = sym (varargin{i}); end + + cmd = { '_ins = (a if isinstance(a, (MatrixBase, NDimArray)) else Matrix([a]) for a in _ins)' + 'from sympy.physics.quantum import TensorProduct' + 'return TensorProduct(*_ins)' }; + c = pycall_sympy__ (cmd, varargin{:}); end +%!error kron (sym (2)) + %!test %! syms x y %! A = [sin(x), sin(y); x, y]; @@ -110,3 +129,17 @@ %! Y = [1, 0; 0, 1]; %! expected = [x, x^2, 0, 0; y, y^2, 0, 0; 0, 0, x, x^2; 0, 0, y, y^2]; %! assert (isequal (kron(Y, X), expected)) + +%!test +%! syms x y z +%! assert (isequal (kron (x, y, z), x*y*z)) +%! assert (isequal (kron (x, y, z, 4), 4*x*y*z)) +%! assert (isequal (kron ([2 3], y, z), [2 3]*y*z)) +%! assert (isequal (kron ([2 3], [4; 5], y), [8 12; 10 15]*y)) + +%!test +%! syms x y +%! A = kron ([x y], [1, -1; -1, 1], [2 3; 4 5]); +%! D = kron ([7 9], [1, -1; -1, 1], [2 3; 4 5]); +%! A = double (subs (A, [x y], [7 9])); +%! assert (isequal (A, D)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/laplace.m new/symbolic-3.1.1/inst/@sym/laplace.m --- old/symbolic-3.0.1/inst/@sym/laplace.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/laplace.m 2023-03-19 19:05:57.000000000 +0100 @@ -96,8 +96,6 @@ %% @seealso{@@sym/ilaplace} %% @end defmethod -%% Author: Colin B. Macdonald, Andrés Prieto -%% Keywords: symbolic, integral transforms function F = laplace(varargin) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/ldivide.m new/symbolic-3.1.1/inst/@sym/ldivide.m --- old/symbolic-3.0.1/inst/@sym/ldivide.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/ldivide.m 2023-03-19 19:05:57.000000000 +0100 @@ -50,8 +50,6 @@ %% @seealso{@@sym/rdivide, @@sym/mldivide} %% @end defop -%% Author: Colin B. Macdonald -%% Keywords: symbolic function z = ldivide(x, y) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/piecewise.m new/symbolic-3.1.1/inst/@sym/piecewise.m --- old/symbolic-3.0.1/inst/@sym/piecewise.m 1970-01-01 01:00:00.000000000 +0100 +++ new/symbolic-3.1.1/inst/@sym/piecewise.m 2023-03-19 19:05:57.000000000 +0100 @@ -0,0 +1,101 @@ +%% Copyright (C) 2022 Alex Vong +%% +%% 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 <https://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @documentencoding UTF-8 +%% @defmethod @@sym piecewise (@var{cond1}, @var{val1}, @var{cond2}, @var{val2}, @dots{}) +%% @defmethodx @@sym piecewise (@var{cond1}, @var{val1}, @var{cond2}, @var{val2}, @dots{}, @var{else_val}) +%% Construct piecewise function. +%% +%% The returned piecewise function evaluates to @var{val1} if @var{cond1} +%% holds, @var{val2} if @var{cond2} holds, @dots{} etc. In the case where none +%% of the conditions hold, it evaluates to @var{else_val} if provided. If +%% @var{else_val} is not provided, it evaluates to @code{nan}. +%% +%% Examples: +%% @example +%% @group +%% syms x real +%% f = piecewise (abs (x) < 1, exp (- 1 / (1 - x^2)), abs (x) >= 1, 0) +%% @result{} f = (sym) +%% ⎧ -1 +%% ⎪ ────── +%% ⎪ 2 +%% ⎨ 1 - x +%% ⎪ℯ for │x│ < 1 +%% ⎪ +%% ⎩ 0 otherwise +%% @end group +%% @end example +%% +%% For this piecewise function, we can omit the redundant condition at the end: +%% @example +%% @group +%% syms x real +%% f = piecewise (abs (x) < 1, exp (- 1 / (1 - x^2)), 0) +%% @result{} f = (sym) +%% ⎧ -1 +%% ⎪ ────── +%% ⎪ 2 +%% ⎨ 1 - x +%% ⎪ℯ for │x│ < 1 +%% ⎪ +%% ⎩ 0 otherwise +%% @end group +%% @end example +%% +%% @seealso{if} +%% @end defmethod + + +function f = piecewise (varargin) + if nargin < 1 + print_usage (); + end + + cmd = {'def pack_args_without_else(args):' + ' return [(val, cond) for cond, val in unflatten(args, 2)]' + 'def pack_args(args):' + ' if len(args) % 2 == 0:' + ' return pack_args_without_else(args)' + ' else:' + ' return pack_args_without_else(args[:-1]) + [(args[-1], True)]' + 'return Piecewise(*pack_args(_ins))' + }; + + args = cellfun (@sym, varargin, 'UniformOutput', false); + f = pycall_sympy__ (cmd, args{:}); +end + + +%!test +%! % basic +%! syms x real +%! f = piecewise (abs (x) < 1, 1); +%! assert (isnan (subs (f, -1))); +%! assert (isequal (subs (f, 0), 1)); +%! assert (isnan (subs (f, 1))); + +%!test +%! % heaviside +%! syms x real +%! f = rewrite (heaviside (x, 1 / sym (2)), 'Piecewise'); +%! g = piecewise (x < 0, 0, x == 0, 1 / sym (2), x > 0, 1); +%! assert (logical (simplify (f == g))); + +%% FIXME: expand test suite, add SMT compat tests, ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/private/ineq_helper.m new/symbolic-3.1.1/inst/@sym/private/ineq_helper.m --- old/symbolic-3.0.1/inst/@sym/private/ineq_helper.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/private/ineq_helper.m 2023-03-19 19:05:57.000000000 +0100 @@ -16,9 +16,6 @@ %% License along with this software; see the file COPYING. %% If not, see <http://www.gnu.org/licenses/>. -%% Author: Colin B. Macdonald -%% Keywords: symbolic - function t = ineq_helper(op, fop, lhs, rhs, nanspecial) if (nargin == 4) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/private/mat_access.m new/symbolic-3.1.1/inst/@sym/private/mat_access.m --- old/symbolic-3.0.1/inst/@sym/private/mat_access.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/private/mat_access.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,5 +1,7 @@ -%% Copyright (C) 2014 Colin B. Macdonald +%% Copyright (C) 2014, 2023 Colin B. Macdonald %% Copyright (C) 2016 Abhinav Tripathi +%% Copyright (C) 2017 Mike Miller +%% Copyright (C) 2017 NVS Abhilash %% %% This file is part of OctSymPy. %% @@ -25,8 +27,6 @@ %% %% @end defun -%% Author: Colin B. Macdonald -%% Keywords: symbolic function z = mat_access(A, subs) @@ -62,7 +62,12 @@ if (ischar(i)) error(['invalid indexing, i="' i '"']) end - [r, c] = ind2sub (size(A), i); + % Octave 8 does not raise error from ind2sub so we do it ourselves + sz = size (A); + if (i > prod (sz)) + error ('%d is out of bound %d (dimensions are %dx%d)\n', i, prod (sz), sz) + end + [r, c] = ind2sub (sz, i); z = mat_rclist_access(A, r(:), c(:)); % output shape, see also logic in comments in mat_mask_access.m if (~isscalar(A) && isrow(A) && isvector(i)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/private/mat_replace.m new/symbolic-3.1.1/inst/@sym/private/mat_replace.m --- old/symbolic-3.0.1/inst/@sym/private/mat_replace.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/private/mat_replace.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,6 +1,7 @@ -%% Copyright (C) 2014-2016, 2019, 2022 Colin B. Macdonald +%% Copyright (C) 2014-2016, 2019, 2022-2023 Colin B. Macdonald %% Copyright (C) 2016 Lagu %% Copyright (C) 2016 Abhinav Tripathi +%% Copyright (C) 2017 NVS Abhilash %% Copyright (C) 2020 Fernando Alvarruiz %% %% This file is part of OctSymPy. @@ -100,7 +101,13 @@ r = subs{1}; c = ones(size(r)); else % linear indices into 2D array - [r, c] = ind2sub (size(A), subs{1}); + % Octave 8 does not raise error from ind2sub so we do it ourselves + sz = size (A); + i = subs{1}; + if (i > prod (sz)) + error ('%d is out of bound %d (dimensions are %dx%d)\n', i, prod (sz), sz) + end + [r, c] = ind2sub (size (A), i); % keep all the indices in a row vector r = reshape (r, 1, []); c = reshape (c, 1, []); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/subsasgn.m new/symbolic-3.1.1/inst/@sym/subsasgn.m --- old/symbolic-3.0.1/inst/@sym/subsasgn.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/subsasgn.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,6 +1,7 @@ -%% Copyright (C) 2014-2017, 2019, 2022 Colin B. Macdonald +%% Copyright (C) 2014-2017, 2019, 2022-2023 Colin B. Macdonald %% Copyright (C) 2016 Lagu %% Copyright (C) 2016 Abhinav Tripathi +%% Copyright (C) 2017 NVS Abhilash %% %% This file is part of OctSymPy. %% @@ -661,6 +662,11 @@ %% Tests from mat_replace +%!error <out of bound> +%! syms x +%! A = [1 x; x 2]; +%! A(5) = x; + %!test %! % 2D indexing with length in one dimension more than 2 %! a = sym ([1 2; 3 4; 5 6]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/subsref.m new/symbolic-3.1.1/inst/@sym/subsref.m --- old/symbolic-3.0.1/inst/@sym/subsref.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/subsref.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,6 +1,7 @@ -%% Copyright (C) 2014, 2016-2017, 2022 Colin B. Macdonald +%% Copyright (C) 2014, 2016-2017, 2022-2023 Colin B. Macdonald %% Copyright (C) 2016 Lagu %% Copyright (C) 2016 Abhinav Tripathi +%% Copyright (C) 2017 NVS Abhilash %% %% This file is part of OctSymPy. %% @@ -273,6 +274,10 @@ %! A = sym([1 2; 3 4]); %! A(1, sym(4)/3) +%!error <out of bound> +%! A = sym([1 2; 3 4]); +%! A(5) + %!shared a, b %! a = [1 2 3 5; 4 5 6 9; 7 5 3 2]; %! b = sym (a); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/symvar.m new/symbolic-3.1.1/inst/@sym/symvar.m --- old/symbolic-3.0.1/inst/@sym/symvar.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/symvar.m 2023-03-19 19:05:57.000000000 +0100 @@ -72,8 +72,6 @@ %% @seealso{findsymbols, @@sym/findsym} %% @end defmethod -%% Author: Colin B. Macdonald, Willem J. Atsma (previous versions) -%% Keywords: symbolic function vars = symvar(F, Nout) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/uplus.m new/symbolic-3.1.1/inst/@sym/uplus.m --- old/symbolic-3.0.1/inst/@sym/uplus.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/uplus.m 2023-03-19 19:05:57.000000000 +0100 @@ -33,8 +33,6 @@ %% @seealso{@@sym/uminus} %% @end defop -%% Author: Colin B. Macdonald -%% Keywords: symbolic function x = uplus(x) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/@sym/ztrans.m new/symbolic-3.1.1/inst/@sym/ztrans.m --- old/symbolic-3.0.1/inst/@sym/ztrans.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/@sym/ztrans.m 2023-03-19 19:05:57.000000000 +0100 @@ -271,8 +271,6 @@ %% %% @end defmethod -%% Author: Alex Vong -%% Keywords: symbolic function X = ztrans (varargin) if (nargin > 3 || nargin == 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/assumptions.m new/symbolic-3.1.1/inst/assumptions.m --- old/symbolic-3.0.1/inst/assumptions.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/assumptions.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,4 +1,4 @@ -%% Copyright (C) 2014-2016, 2019 Colin B. Macdonald +%% Copyright (C) 2014-2016, 2019, 2023 Colin B. Macdonald %% %% This file is part of OctSymPy. %% @@ -108,15 +108,14 @@ cmd = { 'x = _ins[0]' 'outputdict = _ins[1]' - 'd = x._assumptions.generator' - 'if d == {}:' - ' astr = ""' + 'if Version(spver) > Version("1.11.1"):' + ' d = x._assumptions_orig' 'else:' - ' astr = ", ".join(sorted([("" if v else "~") + str(k) for (k,v) in list(d.items())]))' + ' d = x._assumptions.generator' + 'astr = ", ".join(sorted([("" if v else "~") + str(k) for (k,v) in d.items()]))' 'if outputdict:' ' return (astr, d)' - 'else:' - ' return astr,' }; + 'return astr,' }; c = 0; A = {}; if strcmp(outp, 'dict') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/finiteset.m new/symbolic-3.1.1/inst/finiteset.m --- old/symbolic-3.0.1/inst/finiteset.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/finiteset.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,4 +1,4 @@ -%% Copyright (C) 2016-2017, 2019 Colin B. Macdonald +%% Copyright (C) 2016-2017, 2019, 2023 Colin B. Macdonald %% %% This file is part of OctSymPy. %% @@ -46,7 +46,7 @@ %% @example %% @group %% S(2) -%% @print{} ??? ind2sub: index out of range +%% @print{} ??? 2 is out of bound ... %% @end group %% @end example %% Instead you can first convert it to a cell (@pxref{@@sym/children}): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/heaviside.m new/symbolic-3.1.1/inst/heaviside.m --- old/symbolic-3.0.1/inst/heaviside.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/heaviside.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,5 +1,5 @@ %% Copyright (C) 2006 Sylvain Pelissier <sylvain.pelissier@gmail.com> -%% Copyright (C) 2015-2016 Colin B. Macdonald <cbm@m.fsf.org> +%% Copyright (C) 2015-2016, 2019, 2022 Colin B. Macdonald <cbm@m.fsf.org> %% %% This program 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 @@ -35,6 +35,7 @@ %% function returns 0.5 by default: %% @example %% @group +%% @c Would render with an extra zero on earlier Octave %% @c doctest: +SKIP_IF(compare_versions (OCTAVE_VERSION(), '6.0.0', '<')) %% heaviside(0) %% @result{} 0.5000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/private/python_header.py new/symbolic-3.1.1/inst/private/python_header.py --- old/symbolic-3.0.1/inst/private/python_header.py 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/private/python_header.py 2023-03-19 19:05:57.000000000 +0100 @@ -3,6 +3,7 @@ # Copyright (C) 2020 Tianyu Chen (billchenchina) # Copyright (C) 2021 Johannes Maria Frank # Copyright (C) 2022 Chris Gorman +# Copyright (C) 2022 Alex Vong # SPDX-License-Identifier: GPL-3.0-or-later # In some cases this code is fed into stdin: two blank lines between @@ -86,6 +87,8 @@ try: def dbout(l): + # should be kept in sync with the same function + # defined in inst/private/python_ipc_native.m sys.stderr.write("pydebug: " + str(l) + "\n") def d2hex(x): # used to pass doubles back-and-forth diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/private/python_ipc_native.m new/symbolic-3.1.1/inst/private/python_ipc_native.m --- old/symbolic-3.0.1/inst/private/python_ipc_native.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/private/python_ipc_native.m 2023-03-19 19:05:57.000000000 +0100 @@ -107,6 +107,10 @@ '_mypp._print_LambertW = lambda cls, f: _my_rev_print(cls, f, func_name="lambertw")' '_mypp._print_sinc = lambda cls, f: cls._print_Function(f.func(f.args[0]/sp.pi, evaluate=False))' 'del _mypp' + 'def dbout(l):' + ' # should be kept in sync with the same function' + ' # defined in inst/private/python_header.py' + ' sys.stderr.write("pydebug: " + str(l) + "\n")' }, newl)) have_headers = true; end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/symbolic-3.0.1/inst/sympref.m new/symbolic-3.1.1/inst/sympref.m --- old/symbolic-3.0.1/inst/sympref.m 2022-08-09 22:55:47.000000000 +0200 +++ new/symbolic-3.1.1/inst/sympref.m 2023-03-19 19:05:57.000000000 +0100 @@ -1,4 +1,4 @@ -%% Copyright (C) 2014-2020, 2022 Colin B. Macdonald +%% Copyright (C) 2014-2020, 2022-2023 Colin B. Macdonald %% Copyright (C) 2017 NVS Abhilash %% Copyright (C) 2017 Mike Miller %% Copyright (C) 2022 Alex Vong @@ -174,7 +174,7 @@ %% @example %% @group %% sympref version -%% @result{} 3.0.1 +%% @result{} 3.1.1 %% @end group %% @end example %% @@ -217,7 +217,7 @@ case 'version' assert (nargin == 1) - varargout{1} = '3.0.1'; + varargout{1} = '3.1.1'; case 'display' if (nargin == 1)
participants (1)
-
Source-Sync