ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 17 Jun 2018 16:14:23 +0200Translating Gamma from fricas to sage causes exceptionhttps://ask.sagemath.org/question/42626/translating-gamma-from-fricas-to-sage-causes-exception/hello;
I just started trying sage to test Fricas integrate, but for some results, it fails, even though Fricas actually is able to do the integration.
It fails because it can't translate Fricas result to sage syntax, so it gives an exception. I record this as failed integrate, since
for any exception thrown, I assume it failed. But this is not fair for Fricas since it actually did not fail.
Here is an example
sage: var('t, n')
anti=integrate(log(t)^(-n - 1),t, algorithm="fricas")
exception trapped is
NotImplementedError: The translation of the FriCAS
Expression cos((n+1)*pi )*Gamma((-1)*n,(-1)*log(t)) to sage is not yet implemented.
Why it can't translate it, since Maxima result has a gamma in it. Is it the UpperCase Gamma that is the problem?
integrate(log(t)^(-n - 1),t, algorithm="maxima")
-(-log(t))^n*log(t)^(-n)*gamma(-n, -log(t))
No error. I am using
SageMath version 8.3.beta5, Release Date: 2018-06-09
ps. Output from Fricas itself matches what is shown above OK.
FriCAS Computer Algebra System
Version: FriCAS 1.3.3
Timestamp: Sun Jun 17 01:20:37 CDT 2018
(1) -> integrate(log(t)^(-n - 1),t)
(1) cos((n + 1)%pi)Gamma(- n,- log(t))
Type: Union(Expression(Integer),...)Sun, 17 Jun 2018 13:57:59 +0200https://ask.sagemath.org/question/42626/translating-gamma-from-fricas-to-sage-causes-exception/Answer by tmonteil for <p>hello;</p>
<p>I just started trying sage to test Fricas integrate, but for some results, it fails, even though Fricas actually is able to do the integration.</p>
<p>It fails because it can't translate Fricas result to sage syntax, so it gives an exception. I record this as failed integrate, since
for any exception thrown, I assume it failed. But this is not fair for Fricas since it actually did not fail.</p>
<p>Here is an example</p>
<pre><code> sage: var('t, n')
anti=integrate(log(t)^(-n - 1),t, algorithm="fricas")
</code></pre>
<p>exception trapped is</p>
<pre><code>NotImplementedError: The translation of the FriCAS
Expression cos((n+1)*pi )*Gamma((-1)*n,(-1)*log(t)) to sage is not yet implemented.
</code></pre>
<p>Why it can't translate it, since Maxima result has a gamma in it. Is it the UpperCase Gamma that is the problem?</p>
<pre><code> integrate(log(t)^(-n - 1),t, algorithm="maxima")
-(-log(t))^n*log(t)^(-n)*gamma(-n, -log(t))
</code></pre>
<p>No error. I am using </p>
<pre><code> SageMath version 8.3.beta5, Release Date: 2018-06-09
</code></pre>
<p>ps. Output from Fricas itself matches what is shown above OK. </p>
<pre><code> FriCAS Computer Algebra System
Version: FriCAS 1.3.3
Timestamp: Sun Jun 17 01:20:37 CDT 2018
(1) -> integrate(log(t)^(-n - 1),t)
(1) cos((n + 1)%pi)Gamma(- n,- log(t))
Type: Union(Expression(Integer),...)
</code></pre>
https://ask.sagemath.org/question/42626/translating-gamma-from-fricas-to-sage-causes-exception/?answer=42631#post-id-42631The conversion between Fricas and Sage (ginac) gamma functions has been implemented, but not for bivariate gamma:
sage: fricas.Gamma(3/2)
3
Gamma(-)
2
sage: fricas.Gamma(3/2).sage()
1/2*sqrt(pi)
sage: fricas.Gamma(3/2,2)
3
Gamma(-,2)
2
sage: fricas.Gamma(3/2,2).sage()
NotImplementedError: The translation of the FriCAS Expression Gamma(3/2,2) to sage is not yet implemented.
Thanks for reporting, this is now [trac ticket 25597](https://trac.sagemath.org/ticket/25597)Sun, 17 Jun 2018 16:14:23 +0200https://ask.sagemath.org/question/42626/translating-gamma-from-fricas-to-sage-causes-exception/?answer=42631#post-id-42631