GNU logs - #71890, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71890: 31.0.50; Calc can't integrate 0
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 02 Jul 2024 00:48:01 +0000
Resent-Message-ID: <handler.71890.B.171988123622439 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 71890
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 71890 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.171988123622439
          (code B ref -1); Tue, 02 Jul 2024 00:48:01 +0000
Received: (at submit) by debbugs.gnu.org; 2 Jul 2024 00:47:16 +0000
Received: from localhost ([127.0.0.1]:35181 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sORfw-0005pq-BX
	for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 20:47:16 -0400
Received: from lists.gnu.org ([209.51.188.17]:51586)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1sORfr-0005pg-OX
 for submit <at> debbugs.gnu.org; Mon, 01 Jul 2024 20:47:14 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1sORfq-0005z0-LW
 for bug-gnu-emacs@HIDDEN; Mon, 01 Jul 2024 20:47:10 -0400
Received: from mout.web.de ([212.227.17.12])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1sORfo-0004PU-GV
 for bug-gnu-emacs@HIDDEN; Mon, 01 Jul 2024 20:47:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1719881225; x=1720486025;
 i=michael_heerdegen@HIDDEN;
 bh=BrErjfZGzsx6HtECLdhuCSlrnGk3vMbm/mWErRJUVe0=;
 h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type:cc:content-transfer-encoding:content-type:date:from:
 message-id:mime-version:reply-to:subject:to;
 b=igbZJE0ksfLQQ7WPMNwgyg9jH+YUxhSpfBwIGh95zXJY2xmEJrWRG7nz3YGWrMEX
 ciqgAspZZYxnbIY/WVAAd603FlZlBUVP6tT8iVV6r7Mok6ez5hrboaPonIAtvw/E1
 8gJXahqgcxiAbKpKWL5M3xB4OpovZ2v5fD3Sf0dmMyfQMCbmMaDimltwwne7SMTyy
 KCBA+bV/DXoOrnzKpZCfyfIHAOMas9jtMh2OdbHiDyyo3JzbzNjNv1bVq87YF1z5v
 R7Ivs75o02JXQ+p1WTrTCEWCCocwyygfPgsuT5fZXJBMaJHKUHjafkr+sL2jLoAdx
 YvCVm4QuCuZO/FDzwA==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([84.59.210.113]) by smtp.web.de (mrweb106
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MW9vU-1surju43VC-00N36E for
 <bug-gnu-emacs@HIDDEN>; Tue, 02 Jul 2024 02:47:05 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Date: Tue, 02 Jul 2024 02:47:56 +0200
Message-ID: <87cynwty9v.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:p5IDLSnlWtI0HVYSI4/iJW8sSTRXwns/m9zRZQJgDhbVtXM9FQS
 BbbHchxq8QCB7sXwWJhdx1TbA3YcewTumEFBbAfJ8K8KnYW+8PVYj1czFeEwEiNWRf+xhrJ
 GKACO2DnH/H8Bn/DGSZu3RikaFJ+VIZF+tK59qJaO1q7Z/Uvb2k5/iZdZcUQ9/9IyJza8ei
 MOe1Flk5OXZvbFIIh0Hnw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:pfCMBD/IY4k=;w4B3zfJFtPUIE43QV3tc51a++Tb
 AjWjZEI//R/YVEOFm6NB8xgvjUn/X/VDQgGi/wK9fEdX7tBaVseRJQM+tfj2TBdVkKN18q/5Q
 6L2UkUsa9my8S8uDAUKxZTrasIOt1ENdBQTG1gdD0/DTINfbdsA43sSNHIzN4IivqvwAL6Q9J
 Zez/o3DO9QsfnB8VGV5oFusYac2PlU+AWxTeZ1WEJMJUlw5DOyzV5bP0hgDRq54LMcCqggj3e
 du01aR4Rhd/bIHD+PRMSaT62HK6P3J7YeN4tjk4778CcpXDcnZoTlERDS56vL7mMQBGfX6k7U
 Ye8tk9bhKmzvGNUCXflfm6h/Y1lfurywqxPJuQ7yliTuyC8uu9C88e5JJQFXho3rCiuYsn5CF
 gZnTbNRzMKb58gxUINtvKnGGQaBHpF3CcYq2Y6Dl9DhPMydl2e6NeT+aeQVr/PqQxSmad1zqq
 EiTr+zZCNxJvYMRywPux+m0DPX6xyK8nZdMVgGktkogyT4sZesPWQhfj8qNiuNhFxR2emcoQf
 n+d5aXxJaOY8kE2HMkxiDrwe3+qgfPaT+B4cYhBBh0rAcaYuPvo5qG5FPmNcgLDCua0E6fYOY
 FWVpkzWF+AbxsluqikcOIn13X+Mz56WflAiIjQDBrF9pIbJ/U5e6rXKQr8ODfAwmPRxw6ICKI
 e3IcVfEJf9dD+TyewS0eiF2IexyLiiPjLsPd67I9EFMKVEDEzi3d0KWy8LvC7xD54QCa/ulw5
 5TVYRT+hqr++OVSICei0RZotuXWyqY/3lACwFpUg4JpdylSYW2IAP2b2/3vtRfYnraQaztArC
 XhwibcCYmUeadLLfG1AhfKe1S12F3EEUnEZUfPaT0qo6Y=
Received-SPF: pass client-ip=212.227.17.12;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
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,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain


Hello,

Any Calc experts around?  emacs -Q:

  M-x calc RET
  0 RET
  a i x RET

is a way to integrate 0 using Calc (with integration variable x in this
case).  Calc fails to solve it:

The result Calc gives you is "integ(0, x)" - Calc leaves the integral
unresolved, which is Calc's way to say "I can't solve this".  This
is definitely not a feature or a way to represent an integration
constant - (info "(calc) Integration"):

| Also, any indefinite integral should be considered to have an
| arbitrary constant of integration added to it, although Calc does not
| write an explicit constant of integration in its result.

So what is going on?  Other functions, including constants like 1 or a
symbol work as expected.

As far as I understand, Calc is internally perfectly able to solve this
integral but at one place in the code the correct result is rejected
because this case is so special that the authors forgot to make the code
expect a result of such a simple form.  This small change helps:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-WIP-Try-to-fix-integration-of-0.patch
Content-Transfer-Encoding: quoted-printable

=46rom a4351149314af2dab8f03715a9effeb2ee26490c Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Date: Fri, 23 Jun 2023 04:44:34 +0200
Subject: [PATCH] WIP: Try to fix integration of 0

=2D--
 lisp/calc/calcalg2.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el
index 5e9ae8a3e5a..fafbd8418ef 100644
=2D-- a/lisp/calc/calcalg2.el
+++ b/lisp/calc/calcalg2.el
@@ -774,12 +774,13 @@ math-integral
     (setq val math-cur-record)
     (while (vectorp (nth 1 val))
       (setq val (aref (nth 1 val) 0)))
-    (setq val (if (memq (nth 1 val) '(parts parts2))
-		  (progn
-		    (setcar (cdr val) 'parts2)
-		    (list 'var 'PARTS val))
-		(and (consp (nth 1 val))
-		     (nth 1 val))))
+    (let ((val-1 (nth 1 val)))
+      (setq val (if (memq val-1 '(parts parts2))
+		    (progn
+		      (setcar (cdr val) 'parts2)
+		      (list 'var 'PARTS val))
+		  (and (or (consp val-1) (equal val '(0 0)))
+		       val-1))))
     (math-tracing-integral "Integral of "
 			   (math-format-value expr 1000)
 			   "  is  "
=2D-
2.39.2


--=-=-=
Content-Type: text/plain


The problem is: I found this fix by trial and error, someone who knows
the code should verify that the fix is correct.  For example, I don't
know whether 0 is always represented as list (0 0) at this point (given
how many different settings there are...) and whether it is the correct
code place to handle this case.


TIA,

Michael.


In GNU Emacs 31.0.50 (build 15, x86_64-pc-linux-gnu, cairo version
 1.16.0) of 2024-07-02 built on drachen
Repository revision: 7b256c6118326a76e81cc004576c78ba5a475ffd
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-x-toolkit=no --with-native-compilation=no'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LCMS2
LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY OLDXMENU PDUMPER
PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF WEBP X11 XDBE XIM XINPUT2
XPM ZLIB

Important settings:
  value of $LC_ALL: de_DE.utf8
  value of $LC_COLLATE: C
  value of $LC_TIME: C
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix


--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: bug#71890: Acknowledgement (31.0.50; Calc can't integrate 0)
Message-ID: <handler.71890.B.171988123622439.ack <at> debbugs.gnu.org>
References: <87cynwty9v.fsf@HIDDEN>
X-Gnu-PR-Message: ack 71890
X-Gnu-PR-Package: emacs
Reply-To: 71890 <at> debbugs.gnu.org
Date: Tue, 02 Jul 2024 00:48:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 71890 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
71890: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D71890
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 1 Mar 2025 01:49:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 28 20:49:19 2025
Received: from localhost ([127.0.0.1]:55680 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toByh-0005jf-DC
	for submit <at> debbugs.gnu.org; Fri, 28 Feb 2025 20:49:19 -0500
Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:58777)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1toByf-0005jK-3W
 for control <at> debbugs.gnu.org; Fri, 28 Feb 2025 20:49:17 -0500
Received: by mail-ed1-x52b.google.com with SMTP id
 4fb4d7f45d1cf-5e0b70fb1daso4504642a12.1
 for <control <at> debbugs.gnu.org>; Fri, 28 Feb 2025 17:49:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740793751; x=1741398551; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=rEQZLiTfj/x3VTdpaMpXRDsFf3NQTVtQDpozSWZZR2o=;
 b=nK9sXMBv3BMr5utQRVkYMf7jw+12x5lsF5gOhn7qmkomMhlnJTleTxcFD4xg0ELMyQ
 0+ZBXeRn+qHSXhliLC4sbrwUeKsTxwcG3W9KlqnB9u7SLGmjYO/mEDVwXNOFzyMeGKd2
 ISKYAuWm4SpqcwWHjPKxfhUYyrH5FnZiBmeqBtsnm8XKxkKPooY7BIu89C/qH47o9VnH
 CXkF4Hff0T3G1+Rnyfx7tYYb9w6esgTwvOsweTEmUxSQxk8VBonZh7+VjDIT04aB0zXB
 9LmHu/n4CNA5N/sn/UV29zw0GTIi2DbQsb0gxy42Oie7Et5h5MZwHynflGbZX96hEZmD
 QJmw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740793751; x=1741398551;
 h=to:subject:message-id:date:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=rEQZLiTfj/x3VTdpaMpXRDsFf3NQTVtQDpozSWZZR2o=;
 b=rmHNfWS1/Hyr4HJ1IV1FQmWypgHpxYJ3hFH2ehv+T3wQngGBIehZzFSBs0vumH62QU
 bKMw5GAeynJj8tzqFldLODmDzop6d8Lxpps2O8c5dxSN0g/qSYdhzUR3vQxboe85FO/G
 26/9cLGCZpFghQJorxoglHNCzomzP/mjoepQs+f93nTaZNaVSbr4/WAiSTluDHUBFPz7
 yvhbGi8o9+uQgzAbgbQgwjaqYaQHDkZeLYUFAK8n5Bsyzj+Ryn8APOKmvpRq0CN4eO8S
 2lwJEtzRMEhHkrZWfE+0w0pQEesYWlYnXaqn29capqsgzgzryDLFrjwSpNJhPhXi5bu2
 YRlA==
X-Gm-Message-State: AOJu0Yz71zDKWiIa0XY8NeaLJJXvhsxD7iVRuFdyD/j0mlKmJeowyHuM
 mzjo8JOYMqJdA2yQqh3oisC3GU6KNamM1AmWBJuLLX7pd3W8kLnjDfjj1YrqGubsiomFk4W0Qhw
 uLbaNWp4j8kQAw1TLgiJQ2YSCUnyFsNy/
X-Gm-Gg: ASbGncuxEGJU0FHjutXLgCfu4IEKjgZR0/a/Q8jn6JCpllCGVBvZQLjNg1QYvATjFf5
 llc6X0ItLwo2JAbwUnHD2ed5eXTCna+mYlyFSqzwY5HE6f1ewAvkUfWvrV0UKQzSAeTLIWiScP1
 EmJH+hFrRf1etNoeTjxGqherSUUIA=
X-Google-Smtp-Source: AGHT+IFCu2FOpe9DCq5HQdof0jKuBkuo+U0RNlTnaTaBrW3whDLbczMaTqzB9SLXq95w0wRIUzBYeBbhs7JdeXeGznk=
X-Received: by 2002:a05:6402:848:b0:5e0:4064:add6 with SMTP id
 4fb4d7f45d1cf-5e4d6b62d47mr3853071a12.31.1740793751034; Fri, 28 Feb 2025
 17:49:11 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 28 Feb 2025 17:49:10 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
MIME-Version: 1.0
Date: Fri, 28 Feb 2025 17:49:10 -0800
X-Gm-Features: AQ5f1Jpx98h8BpDM9JfIxUK2CBR8jwjEQVk-N2F8qwlaFApyIvkzWaj5imWNqGo
Message-ID: <CADwFkm=vMqWZb1JvdnuAo2aCSrYExORfA4xkUDhPGewouuP+og@HIDDEN>
Subject: control message for bug #71890
To: control <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

tags 71890 + patch
quit




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#71890: 31.0.50; Calc can't integrate 0
Resent-From: Stefan Kangas <stefankangas@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 04 Mar 2025 01:42:02 +0000
Resent-Message-ID: <handler.71890.B71890.174105249726202 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 71890
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 71890 <at> debbugs.gnu.org, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>
Received: via spool by 71890-submit <at> debbugs.gnu.org id=B71890.174105249726202
          (code B ref 71890); Tue, 04 Mar 2025 01:42:02 +0000
Received: (at 71890) by debbugs.gnu.org; 4 Mar 2025 01:41:37 +0000
Received: from localhost ([127.0.0.1]:53356 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tpHHt-0006oX-7r
	for submit <at> debbugs.gnu.org; Mon, 03 Mar 2025 20:41:37 -0500
Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:49488)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tpHHp-0006oG-1W
 for 71890 <at> debbugs.gnu.org; Mon, 03 Mar 2025 20:41:34 -0500
Received: by mail-ed1-x530.google.com with SMTP id
 4fb4d7f45d1cf-5e058ca6806so8280087a12.3
 for <71890 <at> debbugs.gnu.org>; Mon, 03 Mar 2025 17:41:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1741052487; x=1741657287; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=MuJn54oDXOpfKkb32J6KgZyYbt/fsN0mpnyBSw9oFaI=;
 b=YDy4Z0a3EZeTzmQL+8Hmc0V0PABnp7FM3AcM/PaO2xifMOapxZ3vQFGDI90c88GU+k
 rekNX30kJMR/4dJIIOHgyGY07kkR1s4J6fI2sG+TvZxsVA0vRzgMyk46SGp/lCcDGZTi
 /CSVoP/P+Hxs51qjm1vCHxiIoJwcjNaqh2/EDrwVQMH45ZNyC2NifxBl7qgs4LmuYXAs
 guqh/yUqY/6yn//FY/rMrHEjN2B6a5CZQvkvbvFwgUBkDXWw7Vuu4hA+lPdpB4HnRHNZ
 RNEPFIUOl/KLLUCkHvELcmiaj6HkQJGAScPTjd4RyRUFr5JvP2699afiRCj116HCV4WK
 aOlg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1741052487; x=1741657287;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=MuJn54oDXOpfKkb32J6KgZyYbt/fsN0mpnyBSw9oFaI=;
 b=KCPUYbR9I7CUuEZ0xD/CsPPJ6LX4dCNTTzfrnq3zkID9T+M61ewf2CBfgwb8k4mgEf
 6dYGshf3Ilw9gKNJoqqeeGYvaEZ5VlZWePiqWG7sXzecRiH37N9sdgh803bPqj9pMTiF
 Wlt2u1vKSewO7nll5z/RkRwKqtho7wAhsDitZ4vfcF9BGYJ3gJe651jW3RkzOUaciZqu
 1bpPfzNIw/T3TNkGJoZOJBG6LW6+gTeymemBe8B9TiZeURH2Jjl+dDfVK2QKzqMTrouv
 LWvi5LC8a0yzGRAXoWqhu8vkZ8lTehIDtr3YDTWDsDjxQB5/N+foDFjq+xSuT5fn6k6D
 /8JQ==
X-Gm-Message-State: AOJu0YzavGrc+lm/m22YndTzlQ+Qd+/e9tzvyrqxjQXG+EGVuFnFo/cU
 BwC5q5QnHvp8ZJralWMT+x7kWr/Rwj3REFopqaKls1ACaXRcHuZjPsHwvY4PHyoxpOKH7TUEb1d
 B43VNh+QXdMLY5a6rpvBanYD/ntQ=
X-Gm-Gg: ASbGnctNl0HXC8Ri4ecjTLIyWntsQp66ksJ9luZdL4P+XCniQyUi22Eo5546jqgnvom
 K1ouD3/gDJfwbPhmGt8zHpOpYbCqDywdqRE2vennIFWoMU2wofYuc8Xv+J7FDSmOBIhGM25tsKw
 EOzQmz6kzpyfvW/c+W5m7c++3Y8A==
X-Google-Smtp-Source: AGHT+IEQ7E9i2FkQwDxVYO8LMhmOSFn+l6JjJYNWp0BFs3+LOMoq7WhRUq2Ss5k2xeCwAwdrXacVozEzmeaooXhDo+g=
X-Received: by 2002:a05:6402:13d6:b0:5e4:d528:7a76 with SMTP id
 4fb4d7f45d1cf-5e4d6ad5106mr16777527a12.6.1741052486606; Mon, 03 Mar 2025
 17:41:26 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 3 Mar 2025 17:41:26 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87cynwty9v.fsf@HIDDEN>
References: <87cynwty9v.fsf@HIDDEN>
MIME-Version: 1.0
Date: Mon, 3 Mar 2025 17:41:26 -0800
X-Gm-Features: AQ5f1Jp7MkRrKv3C-3dBt8vFG8fR0BcOUVxmtQA-Bx0-roXoHt3qR1YKej3wcEE
Message-ID: <CADwFkm=qz82sbOXcGCC87m8S=7oz6YsPdv=zoXAztRC3ocL1nw@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Hello,
>
> Any Calc experts around?  emacs -Q:

I don't think we do, sadly.  Mattias has looked at it a little bit at
times in the past, maybe he could take a look?

>   M-x calc RET
>   0 RET
>   a i x RET
>
> is a way to integrate 0 using Calc (with integration variable x in this
> case).  Calc fails to solve it:
>
> The result Calc gives you is "integ(0, x)" - Calc leaves the integral
> unresolved, which is Calc's way to say "I can't solve this".  This
> is definitely not a feature or a way to represent an integration
> constant - (info "(calc) Integration"):
>
> | Also, any indefinite integral should be considered to have an
> | arbitrary constant of integration added to it, although Calc does not
> | write an explicit constant of integration in its result.
>
> So what is going on?  Other functions, including constants like 1 or a
> symbol work as expected.
>
> As far as I understand, Calc is internally perfectly able to solve this
> integral but at one place in the code the correct result is rejected
> because this case is so special that the authors forgot to make the code
> expect a result of such a simple form.  This small change helps:
>
> From a4351149314af2dab8f03715a9effeb2ee26490c Mon Sep 17 00:00:00 2001
> From: Michael Heerdegen <michael_heerdegen@HIDDEN>
> Date: Fri, 23 Jun 2023 04:44:34 +0200
> Subject: [PATCH] WIP: Try to fix integration of 0
>
> ---
>  lisp/calc/calcalg2.el | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el
> index 5e9ae8a3e5a..fafbd8418ef 100644
> --- a/lisp/calc/calcalg2.el
> +++ b/lisp/calc/calcalg2.el
> @@ -774,12 +774,13 @@ math-integral
>      (setq val math-cur-record)
>      (while (vectorp (nth 1 val))
>        (setq val (aref (nth 1 val) 0)))
> -    (setq val (if (memq (nth 1 val) '(parts parts2))
> -		  (progn
> -		    (setcar (cdr val) 'parts2)
> -		    (list 'var 'PARTS val))
> -		(and (consp (nth 1 val))
> -		     (nth 1 val))))
> +    (let ((val-1 (nth 1 val)))
> +      (setq val (if (memq val-1 '(parts parts2))
> +		    (progn
> +		      (setcar (cdr val) 'parts2)
> +		      (list 'var 'PARTS val))
> +		  (and (or (consp val-1) (equal val '(0 0)))
> +		       val-1))))
>      (math-tracing-integral "Integral of "
>  			   (math-format-value expr 1000)
>  			   "  is  "
> --
> 2.39.2
>
>
> The problem is: I found this fix by trial and error, someone who knows
> the code should verify that the fix is correct.  For example, I don't
> know whether 0 is always represented as list (0 0) at this point (given
> how many different settings there are...) and whether it is the correct
> code place to handle this case.

We have minimal or no unit tests in this area.

Maybe this would be a good opportunity to add more?





Last modified: Tue, 4 Mar 2025 01:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.