sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.43k stars 479 forks source link

more fricas conversions #33204

Closed fchapoton closed 2 years ago

fchapoton commented 2 years ago

just a few more missing conversions, for Jacobi functions, orthogonal polynomials, etc

CC: @mantepse

Component: interfaces: optional

Keywords: FriCAS

Author: Frédéric Chapoton

Branch/Commit: 46d0501

Reviewer: Martin Rubey, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/33204

fchapoton commented 2 years ago

New commits:

f1cdb5eadding some conversions to/from Fricas functions
fchapoton commented 2 years ago

Branch: u/chapoton/33204

fchapoton commented 2 years ago

Commit: f1cdb5e

mantepse commented 2 years ago
comment:2

Wouldn't it be good to have some doctests? I know very little about these functions, but at the very least it appears that the function names do not quite match up. Possibly, fricas is missing some. For example, at https://fricas.github.io/api/SpecialFunctionCategory.html I cannot find jacobiCs.

One place for such tests might be fricas.py, line 1510.

I guess one could systematically compare some numerical values, to make sure that the definitions agree. For example

sage: jacobi_cn(0.9,2.1) - fricas("jacobiCn")(0.9,2.1).sage()
-7.04818555476145e-20*I

but I have absolutely no idea which values would make sense.

fchapoton commented 2 years ago

Changed keywords from none to FriCAS

tscrim commented 2 years ago
comment:4

Would you be willing to add a doctest for each of these to show the conversions are working correctly?

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from f1cdb5e to b61836d

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

3a2d32bMerge branch 'u/chapoton/33204' in 9.6.b7
b61836dmore doctests for fricas conversions
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

772487amore doctests for fricas conversions of orthogonal polynomials
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from b61836d to 772487a

fchapoton commented 2 years ago
comment:7

now with doctests

tscrim commented 2 years ago
comment:8

Thank you.

Martin, if there is something else you would want to see, you can revert the positive review.

tscrim commented 2 years ago

Reviewer: Martin Rubey, Travis Scrimshaw

mantepse commented 2 years ago
comment:9

I'm sorry to be pedantic, but I find doctests like

sage: fricas(gen_legendre_P(2,1/2,x))  # optional - fricas
            1
legendreP(2,-,x)
            2

not very informative. All this tests is that there is a trivariate fricas function legendreP. It does not test, for example, that the ordering of the variables is as suggested.

I admit that it is a bit of work to find out how much information fricas actually has about these functions. I did some digging:

sage: fricas.legendreP(4,x)
35  4   15  2   3
-- x  - -- x  + -
 8       4      8
sage: fricas.series(fricas.jacobiCn(x,4), x=0)
    1  2   17  4   433  6   2903  8   226327  10      11
1 - - x  + -- x  - --- x  + ---- x  - ------ x   + O(x  )
    2      24      720      5760      518400

sage: fricas.series(fricas.ellipticF(x,2), x=0)
    1  3   19  5    9  7   289  9   279  11      12
x + - x  + -- x  + -- x  + --- x  + --- x   + O(x  )
    2      40      16      384      256
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

46d0501doctest fricas conversions, comment out some dubious ones
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 2 years ago

Changed commit from 772487a to 46d0501

fchapoton commented 2 years ago
comment:12

here are some refined doctests. I will not add more, but feel free to do so.

mantepse commented 2 years ago
comment:13

Great, thank you!

fchapoton commented 2 years ago
comment:14

bump to 9.7

vbraun commented 2 years ago

Changed branch from u/chapoton/33204 to 46d0501