Hello Waldek,

Thank you very much for your prompt answer! I have tried out your code. It 
appears to work.

Fabian
On Wednesday, January 21, 2026 at 8:35:05 PM UTC+1 Waldek Hebisch wrote:

> On Wed, Jan 21, 2026 at 09:52:48AM -0800, Fabian wrote:
> > Hello FriCAS group members,
> > 
> > I am looking for some FriCAS-code that decides whether a given integral 
> is 
> > elementary in the sense of wikipedia 
> > (https://en.wikipedia.org/wiki/Elementary_function). For example, the 
> error 
> > function is NOT elementary in this sense.
> > 
> > I have tried the following Sage-code in the SageMathCell:
> > 
> > from sage.interfaces.fricas import fricas
> > print(fricas.eval("elem?(internalIntegrate(exp(-x^2), x))"))
> > 
> > This produces the output ``true''. From this I conclude that elem? tests 
> > elementarity in a broader sense than that from wikipedia.
> > 
> > I would appreciate any help.
>
> Yes, 'elem?' really means that FriCAS can find the integral,
> either elementary or not. 
>
> FriCAS may use nonelementary function in integral, but should
> do so only when there is no elementary expression. So to
> check that the integral is elementary you need to check if
> FriCAS result is an elementary function. The following
> should do this
>
> elem_ker(k) ==
> symbolIfCan(k) case Symbol or (
> op := operator(k); has?(op, 'elem) or has?(op, '%alg))
>
> elem_expr(ex) == reduce(_and, [elem_ker(k) for k in tower(ex)])
>
> A little explanation: FriCAS expression is a rational function
> of kernels. Kernels may be variables, constants, algebraic
> expressions or application of functions to arguments. To
> check that expression is elementary you need to check that
> each kernel contained in it (directly or indirectly) is elementary.
> 'tower' gives you appropriate list of kerenls. 'elem_ker'
> above checks if kernel is elementary looking at 3 possible cases:
> 'symbolIfCan' checks for variables and constants, 'has?(op, 'elem)'
> checks for elementary transcendental functions, 'has?(op, '%alg)'
> checks for algebraic expressions.
>
> Note: there are cases which FriCAS currently can not decide,
> in such cases intead of returning a result FriCAS throws an
> error.
>
> -- 
> Waldek Hebisch
>

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/677586a1-cfb9-4218-b29d-139c9e0bb591n%40googlegroups.com.

Reply via email to