unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Matt Armstrong <matt@rfc20.org>
Cc: 58929@debbugs.gnu.org
Subject: bug#58929: 29.0.50; Calc: finding roots utpn doesn't work as advertised
Date: Thu, 3 Nov 2022 09:53:02 +0100	[thread overview]
Message-ID: <EA909128-24C5-412B-B609-19C200D15E6D@acm.org> (raw)
In-Reply-To: <87k04es5bt.fsf@rfc20.org>

1 nov. 2022 kl. 23.00 skrev Matt Armstrong <matt@rfc20.org>:

> See attached patch for what I wish the docs had said all along
> (would have saved me a lot of time).

Thank you, I have not worked through your table to confirm all the details but it looks fine on the whole.

One detail: it's not just that the functions are "flat" (ie, all derivatives rapidly vanishing as we stray from the mean) but at least for the normal distribution, Newton actively diverges with a bad starting guess even if computed with infinite precision (draw the graph).

> I wonder if the implementation can be improved.
> https://www.gnu.org/software/emacs/manual/html_node/calc/Root-Finding.html
> suggests that there are some cases where calc will switch over to the
> bisection method.  Perhaps the heuristics can be tweaked?

From what I can tell, bisection is used if there is an interval bracketing the root and either no derivative could be computed or Newton fails to converge. Clearly Newton is preferable when it converges since it's much faster than bisection.

We could employ special tactics by pattern-matching the function expression (perhaps according to your table); not sure if it would be worth the trouble.

Of course an actual numerical analyst would know immediately what to do. Is there one in the audience?







  reply	other threads:[~2022-11-03  8:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31 18:10 bug#58929: 29.0.50; Calc: finding roots utpn doesn't work as advertised Matt Armstrong
2022-11-01 16:51 ` Mattias Engdegård
2022-11-01 22:00   ` Matt Armstrong
2022-11-03  8:53     ` Mattias Engdegård [this message]
2022-11-03  9:13       ` Eli Zaretskii
2022-11-05 19:29         ` Matt Armstrong
2022-11-08 11:00           ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EA909128-24C5-412B-B609-19C200D15E6D@acm.org \
    --to=mattiase@acm.org \
    --cc=58929@debbugs.gnu.org \
    --cc=matt@rfc20.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).