interface to Fricas question. Special function weierstrassPInverse

58 views
Skip to first unread message

Nasser M. Abbasi

unread,
Jan 19, 2024, 8:29:10 AM1/19/24
to sage-devel
Should sagemath translate any special function name returned by external CAS to sagemath known name?

Fricas returns result from integrate using special function weierstrassPInverse. This is returned to sagemath as is. But sagemath says this function is not defined when trying it inside sagemath.

=======================================
sage
│ SageMath version 10.2, Release Date: 2023-12-03                    │
│ Using Python 3.11.6. Type "help()" for help.                       │
sage: var('x,a')
(x, a)
sage: anti=integrate(1/x^(1/2)/(-a^2*x^2+1)^(1/2),x,algorithm="fricas")
sage: anti
2*weierstrassPInverse(4/a^2, 0, x)/sqrt(-a^2)

sage: weierstrassPInverse(4/a^2, 0, x)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [4], line 1
----> 1 weierstrassPInverse(Integer(4)/a**Integer(2), Integer(0), x)

NameError: name 'weierstrassPInverse' is not defined

========================

fricas
                      FriCAS Computer Algebra System
                Version: FriCAS 1.3.10 built with sbcl 2.3.11

(1) -> integrate(1/x^(1/2)/(-a^2*x^2+1)^(1/2),x)
                               4
        2 weierstrassPInverse(--,0,x)
                               2
                              a
   (1)  -----------------------------
                    +----+
                    |   2
                   \|- a
================================

Just wondering what is the protocol here. If sagemath does not know a special function returned by external CAS, what should happen then?

--Nasser

Martin R

unread,
Jan 19, 2024, 8:57:32 AM1/19/24
to sage-devel
Yes, the current strategy is that any expression in FriCAS that sage does not know is turned into a symbolic function with the same name:

        try:
            fun = symbol_table["fricas"][(fun_string, len(args))]
        except KeyError:
            try:
                # to handle the case of "construct"
                fun = symbol_table["fricas"][(fun_string, -1)]
            except KeyError:
                fun = function(fun_string)
Reply all
Reply to author
Forward
0 new messages