I am not an authorative answer, but it seems the Maple definition for the
two argument version works. I just tried it on few values and now Fricas
returns same answer as Mathematica and also as Maxima called from sagemath
---sagemath---------------
var('x')
a=3
anti=integrate(exp_integral_e(a,x),x,algorithm="maxima")
anti.subs(x=3.0)
-----------------
gives
-0.00766504289993192
------- MMA ------------
anti = Integrate[ExpIntegralE[a, x], x]
anti /. {x -> 3.0, a -> 3}
-------------------
gives
-0.00766504
----- sagemath/fricas---------
sage: anti=integrate(x^(a-1)*gamma(1-a,x),x,algorithm="fricas")
sage: anti.subs(x=3.0)
--------------------
gives same
-0.00766504289993192
So the 2 argument function
exp_integral_e(a,x)
in sagemath can be converted to
x^(a-1)*gamma(1-a,x)
internally when calling only fricas since fricas does not know about
exp_integral_e(a,x)
It is up to the caller to insure that correct `a` value is used. But at
least now Fricas will now be able to integrate all these problems using
this conversion by sagemath.
Sagemath 10.3 on Linux
--Nasser
On Wednesday, April 10, 2024 at 2:32:15 AM UTC-5 [email protected] wrote:
> Given an authorative answer, it should not be hard to add that translation
> to the sagemath-fricas interface. Just let me know.
>
> Martin
> On Wednesday 10 April 2024 at 09:16:15 UTC+2 Nasser M. Abbasi wrote:
>
>>
>> " Maple page says:
>>
>> Ei(a, z) = z^(a-1)*GAMMA(1-a, z)
>>
>> In FriCAS that would be
>>
>> Ei(a, z) == z^(a-1)*Gamma(1 - a, z)
>>
>> I am not sure if Maple is right, example above leads to Gamma(0, x)
>> which is undefined."
>>
>> But the help page
>> https://www.maplesoft.com/support/help/maple/view.aspx?path=Ei says
>>
>> "with the exception of the point 0 in the case of
>> Ei1(z)."
>>
>> Ok, so the bottom line is that Fricas does not have a builtin function
>> for the two argument version
>> for exponential integral function that sagemath can translate the call to.
>>
>> In this case, for now, I will remove these problems (135 in total from
>> this particular Rubi test file), because now
>> Fricas fails all of them since sagemath is assuming Fricas has the two
>> argument version.
>>
>> --Nasser
>>
>>
>> On Tuesday, April 9, 2024 at 11:30:13 PM UTC-5 Waldek Hebisch wrote:
>>
>>> On Tue, Apr 09, 2024 at 08:24:35PM -0700, 'Nasser M. Abbasi' via FriCAS
>>> - computer algebra system wrote:
>>> > I found problem integrating many problems using sagemath calling
>>> Fricas to
>>> > do the integration when using exponential integral function. These are
>>> > problems from Rubi test files.
>>> >
>>> > It works OK with other CAS systems supported by sagemath (Maxima and
>>> GIAC)
>>> > but sagemath 10.3 does not seem to correctly translate the call to
>>> Fricas.
>>> >
>>> > I am having hard time finding what the exponential integral function
>>> is
>>> > called before I ask at sagemath forum. I looked at the Fricas book and
>>> do
>>> > not see anything,. I tried Ei but this does not work. (i.e. does not
>>> give
>>> > same answer as other cas systems).
>>>
>>> Well, 'Ei' is "true exponential integral". Other systems ofer you
>>> variants, in FriCAS it is just 'Ei'. Some variants are equivalent
>>> to incomplete gamma function, in such case FriCAS gives you
>>> incomplete gamma.
>>>
>>> > First here is a link to the special function I am taking about
>>> >
>>> > https://reference.wolfram.com/language/ref/ExpIntegralE.html
>>> >
>>> > https://www.maplesoft.com/support/help/maple/view.aspx?path=Ei
>>> >
>>> > Here is a test to what values it should give for some random input. In
>>> > Mathematica it gives
>>> >
>>> > ExpIntegralE[3, 5.0]
>>> > .000877801
>>> >
>>> > In Maple
>>> >
>>> > Ei(3,5.0)
>>> > 0.0008778008928
>>> >
>>> > IN sagemath 10.3
>>> >
>>> > sage: exp_integral_e(3,5.0)
>>> > 0.000877800892770638
>>> >
>>> > But I tried Ei(3,5.0) in Fricas and it gives error.
>>>
>>> 'Ei' takes a single argument. If you need relations between various
>>> functions look into Abramowitz and Stegun, FriCAS Ei is exactly as
>>> defined in Abramowitz and Stegun.
>>>
>>> >
>>> > Here is an example, using sagemath trying to integrate. It works OK
>>> with
>>> > maxima and giac but gives error with Fricas. I am using
>>> >
>>> > >fricas --version
>>> > FriCAS 1.3.10
>>> > based on sbcl 2.3.11
>>> >
>>> > with sagemath
>>> > >sage --version
>>> > SageMath version 10.3, Release Date: 2024-03-19
>>> >
>>> > Starting sagemath and typing:
>>> >
>>> > sage: var('x a b')
>>> > (x, a, b)
>>> >
>>> > sage: integrate(exp_integral_e(1,b*x),x,algorithm="giac")
>>> > integrate(exp_integral_e(1, b*x), x)
>>> >
>>> > sage: integrate(exp_integral_e(1,b*x),x,algorithm="maxima")
>>> > -exp_integral_e(2, b*x)/b
>>> >
>>> > sage: integrate(exp_integral_e(1,b*x),x,algorithm="fricas")
>>> > RuntimeError Traceback (most recent call last)
>>> > TypeError: An error occurred when FriCAS evaluated
>>> > 'exp_integral_e(((1)::EXPR INT),(b)*(x))':
>>> > There are no library operations named exp_integral_e
>>> >
>>> > So clearly sagemath did not translate the exp_integral_e to Fricas
>>> > correctly.
>>> >
>>> > What should the translation look like?
>>>
>>> Maple page says:
>>>
>>> Ei(a, z) = z^(a-1)*GAMMA(1-a, z)
>>>
>>> In FriCAS that would be
>>>
>>> Ei(a, z) == z^(a-1)*Gamma(1 - a, z)
>>>
>>> I am not sure if Maple is right, example above leads to Gamma(0, x)
>>> which is undefined.
>>>
>>> --
>>> 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 on the web visit
https://groups.google.com/d/msgid/fricas-devel/a0532e61-0360-4bb4-bd2c-655a4994aa3cn%40googlegroups.com.