From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#35374: Calc; Div by 0 in solving system Date: Tue, 23 Apr 2019 16:34:58 +0200 Message-ID: <285679AC-2D65-41BD-B672-9D159E4B70FA@acm.org> References: <1555861067.5469.3.camel@qlfiles.net> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="84505"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35374@debbugs.gnu.org To: Christopher Howard Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 23 16:36:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIwWq-000LlD-TK for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Apr 2019 16:36:13 +0200 Original-Received: from localhost ([127.0.0.1]:54739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIwWp-0004Kr-VD for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Apr 2019 10:36:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIwWh-0004KZ-P6 for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 10:36:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIwWg-0005HV-En for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 10:36:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40425) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIwWf-0005H7-VQ for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 10:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hIwWf-0000ku-Nq for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 10:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Apr 2019 14:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35374 X-GNU-PR-Package: emacs Original-Received: via spool by 35374-submit@debbugs.gnu.org id=B35374.15560301072833 (code B ref 35374); Tue, 23 Apr 2019 14:36:01 +0000 Original-Received: (at 35374) by debbugs.gnu.org; 23 Apr 2019 14:35:07 +0000 Original-Received: from localhost ([127.0.0.1]:53966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIwVm-0000jc-R1 for submit@debbugs.gnu.org; Tue, 23 Apr 2019 10:35:07 -0400 Original-Received: from mail236c50.megamailservers.eu ([91.136.10.246]:38510 helo=mail56c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIwVj-0000j1-Dd for 35374@debbugs.gnu.org; Tue, 23 Apr 2019 10:35:05 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1556030101; bh=UwkYEpzYt+zvhujLXygQpm3R6SNRyxhVZIV9yT1IUk8=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=mIbPwAL+ZFaBMPZQ1sD4uru8hTy8UjOtSg3bOANK1Zeac7kEb4V3aNi0RBsZnMjmU 0Vb45HRT8YBsxPfzboXrNDM5NPi9GxGqNQSzU+psgt/wAJCd4pG7IKt4FcSk7KbDV2 EslaOvbJJ37u8Rp9DOzKBZBBA2LqnPeesKm1ISJA= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] ([188.150.171.71]) (authenticated bits=0) by mail56c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x3NEYw15009117; Tue, 23 Apr 2019 14:35:00 +0000 In-Reply-To: <1555861067.5469.3.camel@qlfiles.net> X-Mailer: Apple Mail (2.3445.104.8) X-CTCH-RefID: str=0001.0A0B0203.5CBF2295.0005, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Y+fWTCWN c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=BVC-wYMAAAAA:8 a=E2vXZ1bTqOwGBOxubqEA:9 a=CjuIK1q_8ugA:10 a=L_73hM5gTJBvaLdepetC:22 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158137 Archived-At: 21 apr. 2019 kl. 17.37 skrev Christopher Howard = : > I enabled Debug on Error but could not find the backtrace Reproduced in 26.1. Backtrace below. I quickly got lost in calcalg2.el, but it looks like the equation 2(z - 1.0) - (5 + 3(z - 1.0) - z) / 2 + 3z + 3 =3D 0, isn't solved properly by math-try-solve-for: math-decompose-poly returns = the correct decomposition of the LHS, (4) * z, but then the code decides = to find a root of the polynomial (4) which of course doesn't exist and = nothing good comes out of it. I'm not sure why the floating-point = numbers (float 1 0) are there in the first place. Maybe someone more knowledgeable about Calc can help further. * math-reject-arg((float 1 0) "*Division by zero") math-div-by-zero((float 1 0) 0) math-div((float 1 0) 0) math-float((frac 1 0)) math-mul((frac 1 0) (float 138629436111989 -14)) math-mul-objects-fancy((frac 1 0) (cplx (float 138629436111989 -14) = (float 314159265358979 -14))) math-mul((frac 1 0) (cplx (float 138629436111989 -14) (float = 314159265358979 -14))) math-pow-fancy(-4 (frac 1 0)) math-pow(-4 (frac 1 0)) math-poly-laguerre-root((4) 0 t) math-poly-any-root((4) 0 t) math-try-solve-for((+ (+ (- (* 2 (- (var z var-z) (float 1 0))) (/ (- = (+ 5 (* 3 (- (var z var-z) (float 1 0)))) (var z var-z)) 2)) (* 3 (var z = var-z))) 3) 0 nil nil) math-try-solve-for((calcFunc-eq (+ (- (* 2 (- (var z var-z) (float 1 = 0))) (/ (- (+ 5 (* 3 (- (var z var-z) (float 1 0)))) (var z var-z)) 2)) = (* 3 (var z var-z))) -3) 0 nil) math-solve-for((calcFunc-eq (+ (- (* 2 (- (var z var-z) (float 1 0))) = (/ (- (+ 5 (* 3 (- (var z var-z) (float 1 0)))) (var z var-z)) 2)) (* 3 = (var z var-z))) -3) 0 (var z var-z) nil) math-solve-system-rec((((calcFunc-eq (+ (- (* 2 (- (var z var-z) (float = 1 0))) (/ (- (+ 5 (* 3 (- (var z var-z) (float 1 0)))) (var z var-z)) = 2)) (* 3 (var z var-z))) -3))) ((var z var-z)) (((var y var-y) (- (var z = var-z) (float 1 0))) ((var x var-x) (/ (- (+ 5 (* 3 (- (var z var-z) = (float 1 0)))) (var z var-z)) 2)))) math-solve-system-rec((((calcFunc-eq (- (+ (/ (- (+ 5 (* 3 (var y = var-y))) (var z var-z)) 2) (var y var-y)) (* 2 (var z var-z))) 0)) = ((calcFunc-eq (+ (- (* 2 (var y var-y)) (/ (- (+ 5 (* 3 (var y var-y))) = (var z var-z)) 2)) (* 3 (var z var-z))) -3))) ((var y var-y) (var z = var-z)) (((var x var-x) (/ (- (+ 5 (* 3 (var y var-y))) (var z var-z)) = 2)))) math-solve-system-rec((((calcFunc-eq (+ (- (* 2 (var x var-x)) (* 3 = (var y var-y))) (var z var-z)) 5)) ((calcFunc-eq (- (+ (var x var-x) = (var y var-y)) (* 2 (var z var-z))) 0)) ((calcFunc-eq (+ (- (* 2 (var y = var-y)) (var x var-x)) (* 3 (var z var-z))) -3))) ((var x var-x) (var y = var-y) (var z var-z)) nil) math-solve-system((vec (calcFunc-eq (+ (- (* 2 (var x var-x)) (* 3 (var = y var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ (var x var-x) (var y = var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- (* 2 (var y var-y)) = (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x var-x) (var y = var-y) (var z var-z)) nil) calcFunc-solve((vec (calcFunc-eq (+ (- (* 2 (var x var-x)) (* 3 (var y = var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ (var x var-x) (var y = var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- (* 2 (var y var-y)) = (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x var-x) (var y = var-y) (var z var-z))) apply(calcFunc-solve ((vec (calcFunc-eq (+ (- (* 2 (var x var-x)) (* 3 = (var y var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ (var x var-x) (var = y var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- (* 2 (var y var-y)) = (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x var-x) (var y = var-y) (var z var-z)))) math-normalize((calcFunc-solve (vec (calcFunc-eq (+ (- (* 2 (var x = var-x)) (* 3 (var y var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ (var x = var-x) (var y var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- (* 2 = (var y var-y)) (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x = var-x) (var y var-y) (var z var-z)))) math-simplify((calcFunc-solve (vec (calcFunc-eq (+ (- (* 2 (var x = var-x)) (* 3 (var y var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ (var x = var-x) (var y var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- (* 2 = (var y var-y)) (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x = var-x) (var y var-y) (var z var-z)))) calc-normalize-fancy((calcFunc-solve (vec (calcFunc-eq (+ (- (* 2 (var = x var-x)) (* 3 (var y var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ (var = x var-x) (var y var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- (* 2 = (var y var-y)) (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x = var-x) (var y var-y) (var z var-z)))) calc-normalize((calcFunc-solve (vec (calcFunc-eq (+ (- (* 2 (var x = var-x)) (* 3 (var y var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ (var x = var-x) (var y var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- (* 2 = (var y var-y)) (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x = var-x) (var y var-y) (var z var-z)))) math-evaluate-expr((calcFunc-solve (vec (calcFunc-eq (+ (- (* 2 (var x = var-x)) (* 3 (var y var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ (var x = var-x) (var y var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- (* 2 = (var y var-y)) (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x = var-x) (var y var-y) (var z var-z)))) mapcar(math-evaluate-expr ((calcFunc-solve (vec (calcFunc-eq (+ (- (* 2 = (var x var-x)) (* 3 (var y var-y))) (var z var-z)) 5) (calcFunc-eq (- (+ = (var x var-x) (var y var-y)) (* 2 (var z var-z))) 0) (calcFunc-eq (+ (- = (* 2 (var y var-y)) (var x var-x)) (* 3 (var z var-z))) -3)) (vec (var x = var-x) (var y var-y) (var z var-z))))) #f(compiled-function () #)() calc-do(#f(compiled-function () #) 126) calc-evaluate(1) funcall-interactively(calc-evaluate 1) call-interactively(calc-evaluate nil nil) command-execute(calc-evaluate)