archive/issues_019890.json:
{
"assignees": [],
"body": "<div id=\"comment:0\"></div>\n\nThe implementation of the derivative of the zeta function `zetaderiv` is numerically unstable and very slow (for large negative values):\n\n```\nsage: zetaderiv(1, CIF(-600))\nTraceback (most recent call last):\n...\nNoConvergence: zeta: too much cancellation\n```\n\n```\nsage: timeit('zetaderiv(1, CIF(-500))')\n5 loops, best of 3: 3.08 s per loop\n```\n\nCould either the current implementation be improved or an alternative numerical implementation be used?\n\n---\n\nThis also causes errors when testing relations like\n\n```\nsage: bool(gamma(k*pi) * zetaderiv(1, k*pi*I)/log(2)^2 == 0)\nTraceback (most recent call last):\n...\nNoConvergence: zeta: too much cancellation\n```\n\nCC: @cheuberg @dkrenn @rwst\n\nComponent: **numerical**\n\nAuthor: **Benjamin Hackl**\n\nBranch/Commit: **[u/behackl/symbolic/test_relation/noconvergence](https://github.com/sagemath/sagetrac-mirror/tree/u/behackl/symbolic/test_relation/noconvergence) @ [`4ddf10c`](https://github.com/sagemath/sagetrac-mirror/commit/4ddf10c1c65acabc21bae40d80b51735cf26be24)**\n\n_Issue created by migration from https://trac.sagemath.org/ticket/20127_\n\n",
"created_at": "2016-02-27T07:20:30Z",
"labels": [
"https://github.com/sagemath/sage/labels/c%3A%20numerical",
"https://github.com/sagemath/sage/labels/p%3A%20major%20/%203",
"https://github.com/sagemath/sage/labels/bug"
],
"reactions": [],
"repository": "https://github.com/sagemath/sage",
"title": "zetaderiv: numerically unstable",
"type": "issue",
"updated_at": "2022-12-29T01:35:15Z",
"url": "https://github.com/sagemath/sage/issues/20127",
"user": "https://github.com/behackl"
}
The implementation of the derivative of the zeta function zetaderiv
is numerically unstable and very slow (for large negative values):
sage: zetaderiv(1, CIF(-600))
Traceback (most recent call last):
...
NoConvergence: zeta: too much cancellation
sage: timeit('zetaderiv(1, CIF(-500))')
5 loops, best of 3: 3.08 s per loop
Could either the current implementation be improved or an alternative numerical implementation be used?
This also causes errors when testing relations like
sage: bool(gamma(k*pi) * zetaderiv(1, k*pi*I)/log(2)^2 == 0)
Traceback (most recent call last):
...
NoConvergence: zeta: too much cancellation
CC: @cheuberg @dkrenn @rwst
Component: numerical
Author: Benjamin Hackl
Branch/Commit: u/behackl/symbolic/test_relation/noconvergence @ 4ddf10c
Issue created by migration from https://trac.sagemath.org/ticket/20127
archive/issue_events_281706.json:
{
"actor": "https://github.com/behackl",
"created_at": "2016-02-27T07:20:30Z",
"event": "milestoned",
"issue": "https://github.com/sagemath/sage/issues/20127",
"milestone_number": null,
"milestone_title": "sage-7.1",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20127#event-281706"
}
archive/issue_events_281707.json:
{
"actor": "https://github.com/behackl",
"created_at": "2016-02-27T07:20:30Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20127",
"label": "https://github.com/sagemath/sage/labels/c%3A%20symbolics",
"label_color": "0000ff",
"label_name": "c: symbolics",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20127#event-281707"
}
archive/issue_events_281708.json:
{
"actor": "https://github.com/behackl",
"created_at": "2016-02-27T07:20:30Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20127",
"label": "https://github.com/sagemath/sage/labels/p%3A%20major%20/%203",
"label_color": "ffbb00",
"label_name": "p: major / 3",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20127#event-281708"
}
archive/issue_events_281709.json:
{
"actor": "https://github.com/behackl",
"created_at": "2016-02-27T07:20:30Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20127",
"label": "https://github.com/sagemath/sage/labels/bug",
"label_color": "d73a4a",
"label_name": "bug",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20127#event-281709"
}
archive/issue_comments_288819.json:
{
"body": "Branch: **[u/behackl/symbolic/test_relation/noconvergence](https://github.com/sagemath/sagetrac-mirror/tree/u/behackl/symbolic/test_relation/noconvergence)**",
"created_at": "2016-02-29T06:20:58Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288819",
"user": "https://github.com/behackl"
}
Branch: u/behackl/symbolic/test_relation/noconvergence
archive/issue_comments_288820.json:
{
"body": "Commit: **[`4ddf10c`](https://github.com/sagemath/sagetrac-mirror/commit/4ddf10c1c65acabc21bae40d80b51735cf26be24)**",
"created_at": "2016-02-29T06:20:58Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288820",
"user": "https://github.com/behackl"
}
Commit: 4ddf10c
archive/issue_comments_288821.json:
{
"body": "<div id=\"comment:1\"></div>\n\nNew commits:\n<table><tr><td><a href=\"https://github.com/sagemath/sagetrac-mirror/commit/4ddf10c1c65acabc21bae40d80b51735cf26be24\"><code>4ddf10c</code></a></td><td><code>catch NoConvergence error in test_relation</code></td></tr></table>\n",
"created_at": "2016-02-29T06:20:58Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288821",
"user": "https://github.com/behackl"
}
New commits:
4ddf10c | catch NoConvergence error in test_relation |
archive/issue_comments_288822.json:
{
"body": "<div id=\"comment:2\" align=\"right\">comment:2</div>\n\nLooks fine, can you please add a doctest?",
"created_at": "2016-03-05T07:13:30Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288822",
"user": "https://github.com/rwst"
}
Looks fine, can you please add a doctest?
archive/issue_comments_288823.json:
{
"body": "<div id=\"comment:3\" align=\"right\">comment:3</div>\n\nIn principle I could, yes. However, the simplest (reliable) doctest I can construct takes about 25 sec., and that's not really ideal. I'd really like to understand why this takes so much time.",
"created_at": "2016-03-08T11:43:59Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288823",
"user": "https://github.com/behackl"
}
In principle I could, yes. However, the simplest (reliable) doctest I can construct takes about 25 sec., and that's not really ideal. I'd really like to understand why this takes so much time.
archive/issue_comments_288824.json:
{
"body": "<div id=\"comment:4\" align=\"right\">comment:4</div>\n\nWhich code would that be? Have you tried callgrind? I tried to confirm the random behaviour of the above but the first 16 tries all gave False. Do you have a reliable example?",
"created_at": "2016-03-08T14:29:31Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288824",
"user": "https://github.com/rwst"
}
Which code would that be? Have you tried callgrind? I tried to confirm the random behaviour of the above but the first 16 tries all gave False. Do you have a reliable example?
archive/issue_comments_288825.json:
{
"body": "<div id=\"comment:5\" align=\"right\">comment:5</div>\n\nReplying to [@rwst](#comment%3A4):\n> Which code would that be? Have you tried callgrind? I tried to confirm the random behaviour of the above but the first 16 tries all gave False. Do you have a reliable example?\n\nCould you try it with the following expression? This is the original one which brought me to this error. If it works (which is rarely; maybe one out of 20 times on my laptop here), it takes several seconds.\n\n```\nsage: bool(gamma(2 + k*pi*I/log(2)) * zetaderiv(1, 1+k*pi*I/log(2))/log(2)^10 == 0)\n```",
"created_at": "2016-03-08T14:43:39Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288825",
"user": "https://github.com/behackl"
}
Replying to @rwst:
Which code would that be? Have you tried callgrind? I tried to confirm the random behaviour of the above but the first 16 tries all gave False. Do you have a reliable example?
Could you try it with the following expression? This is the original one which brought me to this error. If it works (which is rarely; maybe one out of 20 times on my laptop here), it takes several seconds.
sage: bool(gamma(2 + k*pi*I/log(2)) * zetaderiv(1, 1+k*pi*I/log(2))/log(2)^10 == 0)
archive/issue_comments_288826.json:
{
"body": "<div id=\"comment:6\" align=\"right\">comment:6</div>\n\nI get 10 times immediately False with develop. I can even do\n\n```\nsage: %timeit assert not bool(gamma(2 + k*pi*I/log(2)) * zetaderiv(1,1+k*pi*I/log(2))/log(2)^10 == 0)\n10 loops, best of 3: 45.3 ms per loop\n```",
"created_at": "2016-03-08T14:48:52Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288826",
"user": "https://github.com/rwst"
}
I get 10 times immediately False with develop. I can even do
sage: %timeit assert not bool(gamma(2 + k*pi*I/log(2)) * zetaderiv(1,1+k*pi*I/log(2))/log(2)^10 == 0)
10 loops, best of 3: 45.3 ms per loop
archive/issue_comments_288827.json:
{
"body": "<div id=\"comment:7\" align=\"right\">comment:7</div>\n\nI think the difference to your result is that I had a command `k = var('k', domain='complex')` instead of `k = var('k')`. With the latter I can confirm the issue. I thought I needed complex because I used `k` as integer before that. Now isn't the default complex anyway? It gets more mysterious.",
"created_at": "2016-03-08T15:07:39Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288827",
"user": "https://github.com/rwst"
}
I think the difference to your result is that I had a command k = var('k', domain='complex')
instead of k = var('k')
. With the latter I can confirm the issue. I thought I needed complex because I used k
as integer before that. Now isn't the default complex anyway? It gets more mysterious.
archive/issue_comments_288828.json:
{
"body": "<div id=\"comment:8\" align=\"right\">comment:8</div>\n\nReplying to [@behackl](#comment%3A5):\n> Could you try it with the following expression? This is the original one which brought me to this error. If it works (which is rarely; maybe one out of 20 times on my laptop here), it takes several seconds.\n> \n> ```\n> sage: bool(gamma(2 + k*pi*I/log(2)) * zetaderiv(1, 1+k*pi*I/log(2))/log(2)^10 == 0)\n> ```\n\n```\nfrom datetime import datetime\nvar('k')\n\nfor _ in range(10):\n tic = datetime.now()\n try:\n result = bool(gamma(2 + k*pi*I/log(2)) * zetaderiv(1, 1+k*pi*I/log(2))/log(2)^10 == 0)\n except Exception as e:\n print datetime.now()-tic, 'exception:', e\n else:\n print datetime.now()-tic, 'successful:', result\n```\nreturns\n\n```\n0:00:11.445669 exception: zeta: too much cancellation\n0:00:08.250215 exception: zeta: too much cancellation\n0:00:03.706793 exception: zeta: too much cancellation\n0:00:02.428823 successful: False\n0:00:00.757367 successful: False\n0:00:16.853168 exception: zeta: too much cancellation\n0:00:00.228982 successful: False\n0:00:03.824248 successful: False\n0:00:37.852729 exception: zeta: too much cancellation\n0:00:15.264686 exception: zeta: too much cancellation\n```\nSeems like I am lucky to get that much exceptions ;)",
"created_at": "2016-03-08T15:24:47Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288828",
"user": "https://github.com/dkrenn"
}
Replying to @behackl:
Could you try it with the following expression? This is the original one which brought me to this error. If it works (which is rarely; maybe one out of 20 times on my laptop here), it takes several seconds.
sage: bool(gamma(2 + k*pi*I/log(2)) * zetaderiv(1, 1+k*pi*I/log(2))/log(2)^10 == 0)
from datetime import datetime
var('k')
for _ in range(10):
tic = datetime.now()
try:
result = bool(gamma(2 + k*pi*I/log(2)) * zetaderiv(1, 1+k*pi*I/log(2))/log(2)^10 == 0)
except Exception as e:
print datetime.now()-tic, 'exception:', e
else:
print datetime.now()-tic, 'successful:', result
returns
0:00:11.445669 exception: zeta: too much cancellation
0:00:08.250215 exception: zeta: too much cancellation
0:00:03.706793 exception: zeta: too much cancellation
0:00:02.428823 successful: False
0:00:00.757367 successful: False
0:00:16.853168 exception: zeta: too much cancellation
0:00:00.228982 successful: False
0:00:03.824248 successful: False
0:00:37.852729 exception: zeta: too much cancellation
0:00:15.264686 exception: zeta: too much cancellation
Seems like I am lucky to get that much exceptions ;)
archive/issue_comments_288829.json:
{
"body": "<div id=\"comment:9\" align=\"right\">comment:9</div>\n\nSee #14305. Variables may by default be complex in Pynac, but they are not in Maxima, which is (still) used by `__nonzero__` (see #19040).",
"created_at": "2016-03-08T15:28:43Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288829",
"user": "https://github.com/rwst"
}
See #14305. Variables may by default be complex in Pynac, but they are not in Maxima, which is (still) used by __nonzero__
(see #19040).
archive/issue_comments_288830.json:
{
"body": "<div id=\"comment:10\" align=\"right\">comment:10</div>\n\nThe exception happens when executing `test_relation()`. With `domain='complex'` `test_relation()` is not called at all because then the assumption `(k, 'complex')` has to be taken into account so Maxima is called for proof which, remarkably, is faster here and correct.\n\nHowever what happens with the original case is that in `test_relation()` random substitutions into the relation are performed to see if the resulting values differ. One substitution that causes the exception is for example `{k: -312.363505734545? + 152.010201758413?*I}` so you can get the exception with the code `(gamma(2 + k*pi*I/log(2)) * zetaderiv(1,1+k*pi*I/log(2))/log(2)^10 == 0).subs({k: CIF(-312.363505734545 + 152.010201758413*I)}).n()` reliably.",
"created_at": "2016-03-08T16:06:50Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288830",
"user": "https://github.com/rwst"
}
The exception happens when executing test_relation()
. With domain='complex'
test_relation()
is not called at all because then the assumption (k, 'complex')
has to be taken into account so Maxima is called for proof which, remarkably, is faster here and correct.
However what happens with the original case is that in test_relation()
random substitutions into the relation are performed to see if the resulting values differ. One substitution that causes the exception is for example {k: -312.363505734545? + 152.010201758413?*I}
so you can get the exception with the code (gamma(2 + k*pi*I/log(2)) * zetaderiv(1,1+k*pi*I/log(2))/log(2)^10 == 0).subs({k: CIF(-312.363505734545 + 152.010201758413*I)}).n()
reliably.
archive/issue_comments_288831.json:
{
"body": "<div id=\"comment:11\" align=\"right\">comment:11</div>\n\nCoincidentally, this solves my original problem. However, I still think that the fact that this\n\n```\nsage: zetaderiv(1, CIF(-600)).n()\n```\nis both very slow and raises the `NoConvergence`-error is a problem.\n\nIs it possible to use a numerically more stable version of the derivative of the zeta function? Maybe someone knowing more about this numerical stuff could help with this.",
"created_at": "2016-03-08T16:30:30Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288831",
"user": "https://github.com/behackl"
}
Coincidentally, this solves my original problem. However, I still think that the fact that this
sage: zetaderiv(1, CIF(-600)).n()
is both very slow and raises the NoConvergence
-error is a problem.
Is it possible to use a numerically more stable version of the derivative of the zeta function? Maybe someone knowing more about this numerical stuff could help with this.
archive/issue_comments_288832.json:
{
"body": "<div id=\"comment:12\" align=\"right\">comment:12</div>\n\nChange of title and component suggested so interested people find it better.",
"created_at": "2016-03-09T09:06:52Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288832",
"user": "https://github.com/rwst"
}
Change of title and component suggested so interested people find it better.
archive/issue_comments_288833.json:
{
"body": "Description changed:\n``````diff\n--- \n+++ \n@@ -1,13 +1,22 @@\n-Testing the following expression for zero randomly results in a `NoConvergence` error being thrown from `mpmath`:\n+The implementation of the derivative of the zeta function `zetaderiv` is numerically unstable and very slow (for large negative values):\n \n ```\n-sage: var('k')\n-k\n-sage: bool(gamma(k*pi) * zetaderiv(1, k*pi*I)/log(2)^2 == 0)\n-False\n+sage: zetaderiv(1, CIF(-600))\n+Traceback (most recent call last):\n+...\n+NoConvergence: zeta: too much cancellation\n ```\n \n-or\n+```\n+sage: timeit('zetaderiv(1, CIF(-500))')\n+5 loops, best of 3: 3.08 s per loop\n+```\n+\n+Could either the current implementation be improved or an alternative numerical implementation be used?\n+\n+---\n+\n+This also causes errors when testing relations like\n \n ```\n sage: bool(gamma(k*pi) * zetaderiv(1, k*pi*I)/log(2)^2 == 0)\n@@ -15,5 +24,3 @@\n ...\n NoConvergence: zeta: too much cancellation\n ```\n-\n-This ticket adds this error to the list of caught errors in `test_relation`.\n``````\n",
"created_at": "2016-03-09T09:14:35Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288833",
"user": "https://github.com/behackl"
}
Description changed:
---
+++
@@ -1,13 +1,22 @@
-Testing the following expression for zero randomly results in a `NoConvergence` error being thrown from `mpmath`:
+The implementation of the derivative of the zeta function `zetaderiv` is numerically unstable and very slow (for large negative values):
```
-sage: var('k')
-k
-sage: bool(gamma(k*pi) * zetaderiv(1, k*pi*I)/log(2)^2 == 0)
-False
+sage: zetaderiv(1, CIF(-600))
+Traceback (most recent call last):
+...
+NoConvergence: zeta: too much cancellation
```
-or
+```
+sage: timeit('zetaderiv(1, CIF(-500))')
+5 loops, best of 3: 3.08 s per loop
+```
+
+Could either the current implementation be improved or an alternative numerical implementation be used?
+
+---
+
+This also causes errors when testing relations like
```
sage: bool(gamma(k*pi) * zetaderiv(1, k*pi*I)/log(2)^2 == 0)
@@ -15,5 +24,3 @@
...
NoConvergence: zeta: too much cancellation
```
-
-This ticket adds this error to the list of caught errors in `test_relation`.
archive/issue_events_281710.json:
{
"actor": "https://github.com/behackl",
"created_at": "2016-03-09T09:14:35Z",
"event": "unlabeled",
"issue": "https://github.com/sagemath/sage/issues/20127",
"label": "https://github.com/sagemath/sage/labels/c%3A%20symbolics",
"label_color": "0000ff",
"label_name": "c: symbolics",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20127#event-281710"
}
archive/issue_events_281711.json:
{
"actor": "https://github.com/behackl",
"created_at": "2016-03-09T09:14:35Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20127",
"label": "https://github.com/sagemath/sage/labels/c%3A%20numerical",
"label_color": "0000ff",
"label_name": "c: numerical",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20127#event-281711"
}
archive/issue_events_281712.json:
{
"actor": "https://github.com/behackl",
"created_at": "2016-03-09T09:14:35Z",
"event": "renamed",
"issue": "https://github.com/sagemath/sage/issues/20127",
"title_is": "zetaderiv: numerically unstable",
"title_was": "test_relation: uncaught NoConvergence",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20127#event-281712"
}
archive/issue_comments_288834.json:
{
"body": "<div id=\"comment:14\" align=\"right\">comment:14</div>\n\nArb can compute derivatives of the zeta function without difficulty. E.g. with my own python-flint interface, I can do\n\n```\n>>> ctx.cap = 10\n>>> acb_series([-600,1]).zeta()\n([7.82232679749e+928 +/- 8.22e+916])*x + ([-3.56689160315e+929 +/- 4.12e+917])*x^2 + ([7.8112800125e+929 +/- 5.34e+918])*x^3 + ([-1.08969439943e+930 +/- 6.02e+918])*x^4 + ([1.07928682824e+930 +/- 9.55e+918])*x^5 + ([-7.957487571e+929 +/- 4.23e+919])*x^6 + ([4.390792240e+929 +/- 6.15e+919])*x^7 + ([-1.700332217e+929 +/- 6.11e+919])*x^8 + ([3.04336993e+928 +/- 6.00e+919])*x^9 + O(x^10)\n```\n\nwhich takes 0.1 milliseconds.\n\nThis would be easier to wrap with a Sage wrapper for Arb power series in place, but it should not be too hard to do directly either: see `acb_poly_zeta_series` and `arb_poly_zeta_series`.\n\nIn the left half plane, `mpmath.diff(mpmath.zeta, s, n)` could also be used instead of `mpmath.zeta(s, 1, n)`.\n\nIt's a bit worrying that `zetaderiv` currently accepts CIF input and outputs a *nonrigorous* CIF without warning, by going through a plain numerical computation. It is easy to produce examples where the output is plain *wrong*:\n\n```\nsage: q = CIF(\"2.46316186945432128587439505331\", \"23.2983204927628579020109616266\")\nsage: zetaderiv(1,q)\n-3.8826886735960628?e-17 - 7.4180200774526877?e-17*I\nsage: q = ComplexIntervalField(128)(\"2.46316186945432128587439505331\", \"23.2983204927628579020109616266\")\nsage: zetaderiv(1,q)\n2.809208149461043895562049836274827424167?e-31 + 4.678424144202694674839595616043132108038?e-32*I\n```\n\nAre there other Sage functions that treat intervals as carelessly?",
"created_at": "2016-03-09T12:02:11Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20127",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20127#issuecomment-288834",
"user": "https://github.com/fredrik-johansson"
}
Arb can compute derivatives of the zeta function without difficulty. E.g. with my own python-flint interface, I can do
>>> ctx.cap = 10
>>> acb_series([-600,1]).zeta()
([7.82232679749e+928 +/- 8.22e+916])*x + ([-3.56689160315e+929 +/- 4.12e+917])*x^2 + ([7.8112800125e+929 +/- 5.34e+918])*x^3 + ([-1.08969439943e+930 +/- 6.02e+918])*x^4 + ([1.07928682824e+930 +/- 9.55e+918])*x^5 + ([-7.957487571e+929 +/- 4.23e+919])*x^6 + ([4.390792240e+929 +/- 6.15e+919])*x^7 + ([-1.700332217e+929 +/- 6.11e+919])*x^8 + ([3.04336993e+928 +/- 6.00e+919])*x^9 + O(x^10)
which takes 0.1 milliseconds.
This would be easier to wrap with a Sage wrapper for Arb power series in place, but it should not be too hard to do directly either: see acb_poly_zeta_series
and arb_poly_zeta_series
.
In the left half plane, mpmath.diff(mpmath.zeta, s, n)
could also be used instead of mpmath.zeta(s, 1, n)
.
It's a bit worrying that zetaderiv
currently accepts CIF input and outputs a nonrigorous CIF without warning, by going through a plain numerical computation. It is easy to produce examples where the output is plain wrong:
sage: q = CIF("2.46316186945432128587439505331", "23.2983204927628579020109616266")
sage: zetaderiv(1,q)
-3.8826886735960628?e-17 - 7.4180200774526877?e-17*I
sage: q = ComplexIntervalField(128)("2.46316186945432128587439505331", "23.2983204927628579020109616266")
sage: zetaderiv(1,q)
2.809208149461043895562049836274827424167?e-31 + 4.678424144202694674839595616043132108038?e-32*I
Are there other Sage functions that treat intervals as carelessly?
archive/issue_events_281713.json:
{
"actor": "https://github.com/mkoeppe",
"created_at": "2022-12-29T01:35:15Z",
"event": "demilestoned",
"issue": "https://github.com/sagemath/sage/issues/20127",
"milestone_number": null,
"milestone_title": "sage-7.1",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20127#event-281713"
}