From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#41223: 28.0.50; Calc gives wrong determinant for some matrices with symbolic variables Date: Tue, 12 May 2020 20:24:42 -0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000059742d05a57bc547" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="36006"; mail-complaints-to="usenet@ciao.gmane.io" To: 41223@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 13 01:26:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYeHq-0009FE-Ls for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 May 2020 01:26:10 +0200 Original-Received: from localhost ([::1]:34766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYeHp-0003eV-E8 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 May 2020 19:26:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYeHi-0003e9-Vb for bug-gnu-emacs@gnu.org; Tue, 12 May 2020 19:26:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYeHi-0005Cd-N4 for bug-gnu-emacs@gnu.org; Tue, 12 May 2020 19:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jYeHi-0005H4-IB for bug-gnu-emacs@gnu.org; Tue, 12 May 2020 19:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 May 2020 23:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41223 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.158932590220161 (code B ref -1); Tue, 12 May 2020 23:26:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 May 2020 23:25:02 +0000 Original-Received: from localhost ([127.0.0.1]:56850 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYeGj-0005Ey-Go for submit@debbugs.gnu.org; Tue, 12 May 2020 19:25:02 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:39014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYeGh-0005El-74 for submit@debbugs.gnu.org; Tue, 12 May 2020 19:24:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYeGh-00037B-1F for bug-gnu-emacs@gnu.org; Tue, 12 May 2020 19:24:59 -0400 Original-Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:38641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYeGe-0004wL-O9 for bug-gnu-emacs@gnu.org; Tue, 12 May 2020 19:24:58 -0400 Original-Received: by mail-wm1-x32e.google.com with SMTP id g12so26074016wmh.3 for ; Tue, 12 May 2020 16:24:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=oyVQ98DWd/qkRgwED+s8RsISSmU3r3SV86YHnL+oVZA=; b=iLWLgZkvATfp3WPbUNo1gF7PlcU6IQw4RS48VWuQ6MqpUhEPNJBnnV9oSA8QKWs2Qw L+IV4w8SpycuZ1j0OfOZd7CaLRSvCzkovDDQ31zqFK7cRdOEWxG7f/YtIQSFnPAO+O55 VZBo5Zpdc2tNIwAz8USygV/nPbAvJriKHOW1igrb1Sma3Abw9pyPbARWSPIUzx4Ltrtz YrnlzbeJ5CrAv01Oc6P1l6d+f/UoptaK61CwoN5sevI2OC5Qh5HZ6L7mHFOEqJJsxXbh BJLC5VoiTpS/02twzhKUpEOo0vlyqEMPAUZAowlfjohHtYwdCA4IuIIebulkuXFOCSmG YbdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=oyVQ98DWd/qkRgwED+s8RsISSmU3r3SV86YHnL+oVZA=; b=j6yxQ/IaKBcV7x5BXBqgfFP0dUJPDYmQI9Tw3W1mX6/pAQ0SbTOOO3YDCSTAVVnD9i 6nqgOybRuyCfWZ1CxBK4k9pom00NkVWqVQpQvbKRf0tNk/Z85WR3UChdJ13cfjogDW2v DWlHRwlB6uxe0heooD78LEXwuDrbIzNxKhEtTww9MSXhkRmkuQtDO/NUMLZl3ioogCeJ aPnazkUPetVF8qEsMrqnTld1tnohYoWjuvgdAIYZMSH8ovqU/XU4HUgy4XSuD0rmWg/Q EXRcbxjpnYQ75uXPA1QznlSMGSk14GvFXxHJv/OsNj/Hnj7ztu8lMjusvTW8/fAYLhxi UYYw== X-Gm-Message-State: AGi0Pua2Y+J6ri/dnMwMV5o9Hz5JXQ6ws5yrJo2YWogaLbXwuNNG1rYA 9AhnRiMVGlC0UCINiiEyqKywl6tt4OcDM/ThiN3JgBGxuAA= X-Google-Smtp-Source: APiQypJlvmM9DkOCGXg8xbIlhY8ENuSISFOq0CQrB2x/1nic1RUStzQN1QU6PM//NcTtbzqfJhInFa2Pak/UWVrGuoE= X-Received: by 2002:a1c:7308:: with SMTP id d8mr19362622wmb.6.1589325894086; Tue, 12 May 2020 16:24:54 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=maurooaranda@gmail.com; helo=mail-wm1-x32e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180131 Archived-At: --00000000000059742d05a57bc547 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I found this problem with matrices larger than 3x3. Consider a matrix like this: 1 0 0 0 0 1 0 0 0 0 0 1 0 0 a 0 Its determinant is -a, but Calc says its 0. Steps to reproduce: 1) emacs -Q 2) Start Calc: C-x * c 3) Enter algebraic mode by typing ' 4) Enter the above matrix, like this: [[1 0 0 0][0 1 0 0][0 0 0 1][0 0 a 0]] 5) Calculate the determinant: V D Calc says that the determinant is 0, which is wrong. If, however, a is replaced with a value, say 5, Calc correctly solves it and reports the determinant as -5. With a 3x3 matrix, the result is correct. That is: V D on [[1 0 0][0 0 1][0 a 0]] gives -a as the result. I think the algorithm for choosing the pivots should be improved to be able to permutate the rows and choose a symbolic variable as the pivot. In GNU Emacs 28.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10) of 2020-05-12 built on tbb-desktop Repository revision: 703115829b35de6a90d7bafb7931f905e79d0d35 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12005000 System Description: Ubuntu 18.04.4 LTS Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. C-x * (Type ? for a list of Calc options) Welcome to the GNU Emacs Calculator! Press =E2=80=98?=E2=80=99 or =E2=80= =98h=E2=80=99 for help, =E2=80=98q=E2=80=99 to quit Working... LUD step =3D 3/4 C-x * (Type ? for a list of Calc options) Configured features: XPM JPEG TIFF GIF PNG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY GNUTLS FREETYPE HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER GMP Important settings: value of $LC_MONETARY: es_AR.UTF-8 value of $LC_NUMERIC: es_AR.UTF-8 value of $LC_TIME: es_AR.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils calc-arith calc-mtx calccomp calc-alg calc-vec calc-aent calc-menu easymenu calc-misc calc-prog calc-ext cl-loaddefs cl-lib calc calc-loaddefs calc-macs tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 76586 9357) (symbols 48 9259 1) (strings 32 22656 1028) (string-bytes 1 685264) (vectors 16 11989) (vector-slots 8 156067 9126) (floats 8 28 37) (intervals 56 207 0) (buffers 992 12)) --00000000000059742d05a57bc547 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I found this problem with matrices larger than 3x3.
Consider a matrix like this:
1 0 0 0
0 1 0 0
0 0 0 1
0 0 a 0
Its determinant is -a, but Calc says its 0.

Steps to reproduce= :

1) emacs -Q
2) Start Calc: C-x * c
3) Enter algebraic mode b= y typing '
4) Enter the above matrix, like this:
[[1 0 0 0][0 1 0= 0][0 0 0 1][0 0 a 0]]
5) Calculate the determinant: V D

Calc say= s that the determinant is 0, which is wrong.

If, however, a is repla= ced with a value, say 5, Calc correctly solves it
and reports the determ= inant as -5.

With a 3x3 matrix, the result is correct.=C2=A0 That is= :
V D on [[1 0 0][0 0 1][0 a 0]] gives -a as the result.

I think the algorithm for choosing the pivots should be improved to= be
able to permutate the rows and choose a symbolic variable as the piv= ot.

In GNU Emacs 28.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ = Version 3.22.30, cairo version 1.15.10)
=C2=A0of 2020-05-12 built on t= bb-desktop
Repository revision: 703115829b35de6a90d7bafb7931f905e79d0d35=
Repository branch: master
Windowing system distributor 'The X.Or= g Foundation', version 11.0.12005000
System Description: Ubuntu 18.0= 4.4 LTS

Recent messages:
For information about GNU Emacs and the = GNU system, type C-h C-a.
C-x * =C2=A0(Type ? for a list of Calc options= )
Welcome to the GNU Emacs Calculator!=C2=A0 Press =E2=80=98?=E2=80=99 o= r =E2=80=98h=E2=80=99 for help, =E2=80=98q=E2=80=99 to quit
Working... L= UD step =3D 3/4
C-x * =C2=A0(Type ? for a list of Calc options)

C= onfigured features:
XPM JPEG TIFF GIF PNG CAIRO SOUND DBUS GSETTINGS GLI= B NOTIFY INOTIFY
GNUTLS FREETYPE HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS GTK3 = X11 XDBE XIM
MODULES THREADS PDUMPER GMP

Important settings:
= =C2=A0 value of $LC_MONETARY: es_AR.UTF-8
=C2=A0 value of $LC_NUMERIC: e= s_AR.UTF-8
=C2=A0 value of $LC_TIME: es_AR.UTF-8
=C2=A0 value of $LAN= G: en_US.UTF-8
=C2=A0 locale-coding-system: utf-8-unix

Major mode= : Lisp Interaction

Minor modes in effect:
=C2=A0 tooltip-mode: t<= br>=C2=A0 global-eldoc-mode: t
=C2=A0 eldoc-mode: t
=C2=A0 electric-i= ndent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
= =C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global= -font-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode:= t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: t
= =C2=A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2=A0 tra= nsient-mark-mode: t

Load-path shadows:
None found.

Feature= s:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs=
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-confi= g
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x s= eq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode=
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
= rfc2045 ietf-drums mm-util mail-prsvr mail-utils calc-arith calc-mtx
cal= ccomp calc-alg calc-vec calc-aent calc-menu easymenu calc-misc
calc-prog= calc-ext cl-loaddefs cl-lib calc calc-loaddefs calc-macs
tooltip eldoc = electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win = x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe= tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-m= ode register page tab-bar menu-bar rfn-eshadow isearch
timer select scro= ll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-color= s frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnam= ese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew gr= eek romanian slovak czech european
ethiopic indian cyrillic chinese comp= osite charscript charprop
case-table epa-hook jka-cmpr-hook help simple = abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macro= exp files
text-properties overlay sha1 md5 base64 format env code-pages = mule
custom widget hashtable-print-readable backquote threads dbusbindinotify dynamic-setting system-font-setting font-render-setting cairo
= move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

M= emory information:
((conses 16 76586 9357)
=C2=A0(symbols 48 9259 1)<= br>=C2=A0(strings 32 22656 1028)
=C2=A0(string-bytes 1 685264)
=C2=A0= (vectors 16 11989)
=C2=A0(vector-slots 8 156067 9126)
=C2=A0(floats 8= 28 37)
=C2=A0(intervals 56 207 0)
=C2=A0(buffers 992 12))
--00000000000059742d05a57bc547--