On Wed, Jul 08, 2026 at 01:01:41PM +0200, Kurt Pagani wrote:
>
>
> On 08/07/2026 08:18, 'Ralf Hemmecke' via FriCAS - computer algebra system
> wrote:
> > On 7/8/26 03:24, Qian Yun wrote:
> > > There are numerous open source numeric scientific programs,
> > > is it a good idea to choose a mature one and model after it?
> Symbolic relations (simpl) of special functions are more important to me
> than numeric evaluations, i.e. nice to have but not essential. The
> hypergeometricF in EXPR INT, for instance, can be differentiated correctly
> (mostly), but has no simplifications like hypergeometricF([0],[0],z) ->
> exp(z).
That is somewhat controversial thing. Namely, advanced algorithms
frequently depend on exact form of representation. Unexpected change
to representation can lead to bugs. It is possible that having
by default simplifications like
hypergeometricF([..., a, ...],[..., a, ...], z) ->
hypergeometricF([..., ...],[..., ...], z)
(that is deleting common parameter), would cause no troube.
Similarly
hypergeometricF([], [],z) -> exp(z)
looks relatively safe (and combination of the 2 above would give
what you want). Still, ATM I decided to severly limit default
simplifications of hypergeometricF functions.
There is different thing with transformations done on demand.
We should have various transfomations. Simply there is a lot
of them and there is question how to best organize them.
ATM I am thinking of extending 'normalize' so that it can
detect dependencies between hypergeometricF and meijerG.
And separte "denormalization" routine supposed to detect
cases when hypergeometricF and meijerG can be expressed in
a simpler form.
> This is is bug by the way.
> D(hypergeometricF([0],[0],x),x)
>
> >> Error detected within library code:
> catdef: division by zero
I see.
(24) -> D(hypergeometricF([],[],x), x)
(24) hypergeometricF([],[],x)
Type: Expression(Integer)
works as expected, so probably detecting that 0 cancels is
enough.
> D(hypergeometricF([a],[b],z),z) -> ?
(25) -> D(hypergeometricF([a],[b],z),z)
a hypergeometricF([a + 1],[b + 1],z)
(25) ------------------------------------
b
Type: Expression(Integer)
That is fine. Trouble is that 0 as lower parameter has somewhat
dubious status.
> > I would even go as far as using such libraries for FriCAS.
> > Yes, it is new dependency, but why not using open-source effort of
> > others and continue with other things. We already rely on GMP (if
> > available), why not doing the same with other libraries, FLINT, for
> > example?
>
> If at all, then why not use GSL? It's easy to access via CL.
>
https://www.gnu.org/software/gsl/doc/html/specfunc.html
>
> @Waldek: What do you think about the approach in
>
> Fast and Accurate Bessel Function Computation
> John Harrison
> Intel Corporation, JF1-13
>
https://www.cl.cam.ac.uk/~jrh13/papers/bessel.pdf
That paper nicely illustrates troubles. First, people do a lot
of work on various special cases, he really considers only real
arguments and oders 0 and 1, that allows using precomputed special
approximations. This does not scale to arbitrary complex
orders and arguments. Second, he admits using Itanium 128 bit
hardware floats. Having extra precision in intermediate
calculations helps a lot. But pupular machines do not have
128 bit hardware floats and software floating point is
_much_ more expensive than hardware one, so once you use
extended precision "fast" part is no longer valid. CMUCL
has thing called double-double, which should be good enough
for our purposes. But IIUC no other Lisp supports it.
--
Waldek Hebisch