Opened 4 years ago

Closed 7 months ago

Last modified 7 months ago

#24820 closed enhancement (duplicate)

Upgrade to lcalc-1.3

Reported by: rws Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: packages: standard Keywords: lcalc
Cc: rishi, gh-timokau Merged in:
Authors: Reviewers: Matthias Koeppe
Report Upstream: N/A Work issues:
Branch: u/rws/upgrade_to_lcalc_1_3 (Commits, GitHub, GitLab) Commit: 5ee080ec072d2a21051f589b19e135ac5a965bfc
Dependencies: Stopgaps:

Status badges

Description (last modified by slelievre)

lcalc is not actively maintained by the author. His latest version lcalc-1.3 was deposited at https://code.google.com/archive/p/l-calc/. This was recently imported to https://github.com/dimpase/lcalc to make it available.

Followup from #23341.

Closed as duplicate. See #32037.

Change History (18)

comment:1 Changed 4 years ago by rws

Will update the description as soon as we have a tarball.

comment:2 Changed 4 years ago by rws

  • Branch set to u/rws/upgrade_to_lcalc_1_3

comment:3 Changed 4 years ago by rws

  • Commit set to 5ee080ec072d2a21051f589b19e135ac5a965bfc
  • Description modified (diff)

One problem worked around was that the use of FP type (double,mpfr,etc..) can be given to make but is not fixed in a header like with conf.h in other packages. I have hardcoded the type used until now (double) but this is an issue.


New commits:

d3a1dabversion
ea4c114remove patches
5ee080efind_zeros_via_N_v no longer exists

comment:4 Changed 4 years ago by rws

This is the only error with the code in the pull request that is not cured by a slight increase in tolerance:

File "src/sage/libs/lcalc/lcalc_Lfunction.pyx", line 185, in sage.libs.lcalc.lcalc_Lfunction.Lfunction.hardy_z_function
Failed example:
    L.hardy_z_function(.4+.3*I)
Expected:
    0.2166144222685... - 0.00408187127850...*I
Got:
    0.0240947990422030 + 0.215308871779581*I

comment:5 Changed 4 years ago by rws

Note that hardy_z_function calls ...value(s, 0, "rotated pure") but the value definition both in lcalc-1.23 and 1.3 does not check for the rotated pure return type argument. Member functions that do have special code for this argument are value_via_Riemann_sum or value_via_gamma_sum.

comment:6 Changed 4 years ago by rws

  • Cc rishi added

@rishi What's your opinion? Should we call a different value function? Do you have an example where you know the result of a nontrivial character from other means than lcalc?

comment:7 Changed 4 years ago by rws

I just see we can compare with arb: http://fredrikj.net/blog/2016/11/dirichlet-l-functions-in-arb/

It would be nice to have that in Sage, too. See #24823.

Last edited 4 years ago by rws (previous) (diff)

comment:8 follow-up: Changed 4 years ago by rws

It seems I cannot reproduce lcalc-1.23 results of quadratic characters with arb, and the primitive ones only for L() values not Z():

#include "dirichlet.h"
#include "acb_dirichlet.h"

int main()
{
    dirichlet_group_t G;
    dirichlet_char_t chi;
    acb_t z, v, s;
    slong prec;
    FILE * fp = stdout;

    acb_init(z); acb_init(v); acb_init(s);
    dirichlet_group_init(G, 5);
    dirichlet_char_init(chi, G);
    dirichlet_char_log(chi, G, 1);
    prec = 53;

    acb_set_d_d(s, 0.4, 0.3);
    acb_dirichlet_l(v, s, G, chi, prec);
    acb_dirichlet_hardy_z(z, s, G, chi, 1, prec);
    arb_fprintn(fp, acb_realref(v), 15, ARB_STR_NO_RADIUS); fprintf(fp, " ");
    arb_fprintn(fp, acb_imagref(v), 15, ARB_STR_NO_RADIUS); fprintf(fp, "\n");
    arb_fprintn(fp, acb_realref(z), 15, ARB_STR_NO_RADIUS); fprintf(fp, " ");
    arb_fprintn(fp, acb_imagref(z), 15, ARB_STR_NO_RADIUS); fprintf(fp, "\n");
    dirichlet_group_clear(G);
    dirichlet_char_clear(chi);
    acb_clear(z); acb_clear(v); acb_clear(s);
}

out:

0.746399760988757 0.306435517808510
0.83536589483338 0.06481096520271

compare lcalc-1.23:

sage: chi = DirichletGroup(5)[1]
sage: L = Lfunction_from_character(chi, type="complex")
sage: L.value(.4+.3*I)
0.746399760988764 + 0.306435517808512*I
sage: L.hardy_z_function(.4+.3*I)
0.773263920478260 + 0.00234761924684610*I
Last edited 4 years ago by rws (previous) (diff)

comment:9 follow-ups: Changed 4 years ago by jdemeyer

Note that PARI/GP should also be able to do this computation, but I'm too lazy right now to check.

comment:10 in reply to: ↑ 9 Changed 4 years ago by rws

Replying to jdemeyer:

Note that PARI/GP should also be able to do this computation, but I'm too lazy right now to check.

That would be:

? lfun([znstar(5, 1), [1]], .4+.3*I)
%36 = 0.74639976098875732745027783743802269503 + 0.30643551780851000234523726566712518702*I

lfunhardy in current Sage's Pari only accepts real input. The doctest above has complex input; I have no idea about the usefulness of complex argument results.

comment:11 in reply to: ↑ 9 Changed 4 years ago by rws

Let's compare results for Z with real argument, say 0.4.

With the DirichletGroup(5)[1] character, lcalc-1.23 as interfaced in Sage gives 0.851280933431727 with small imaginary component; lcalc-1.3 agrees 0.851280933431744; Pari returns 0.80484991588823009664634764248195907182, and arb 0.85128093343172.

With the DirichletGroup(5)[2] character it's 0.300129189728995, 0.300129189729034, and 0.95412902109286908441627436043139472906 from Pari. So the problem is with complex input and with specific characters.

comment:12 Changed 4 years ago by chapoton

  • Keywords lcalc added

comment:13 in reply to: ↑ 8 Changed 3 years ago by gh-timokau

Replying to rws:

Note that hardy_z_function calls ...value(s, 0, "rotated pure") but the value definition both in lcalc-1.23 and 1.3 does not check for the rotated pure return type argument. Member functions that do have special code for this argument are value_via_Riemann_sum or value_via_gamma_sum.

Replying to rws:

It seems I cannot reproduce lcalc-1.23 results of quadratic characters with arb, and the primitive ones only for L() values not Z(): ...

Sounds like that feature was pretty much always broken and that new doctest value is "just as good" (or just as bad) as the old one. Is that correct?

comment:14 Changed 23 months ago by gh-timokau

  • Cc gh-timokau added

comment:15 Changed 7 months ago by mjo

  • Milestone changed from sage-8.2 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

I think we should close this in favor of #32037. Some of the test problems persist there, but I think that's the sort of bug we might overlook to get rid of our horribly outdated lcalc-1.23.

comment:16 Changed 7 months ago by mkoeppe

  • Reviewers set to Matthias Koeppe
  • Status changed from needs_review to positive_review

comment:17 Changed 7 months ago by chapoton

  • Resolution set to duplicate
  • Status changed from positive_review to closed

comment:18 Changed 7 months ago by slelievre

  • Description modified (diff)
Note: See TracTickets for help on using tickets.