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.Thu, 02 Jul 2015 09:12:31 +0200Another problem with integralhttps://ask.sagemath.org/question/27237/another-problem-with-integral/This is a follow-up to 'Problem with integral' which is a follow-up of 'Problem with hypergeometric'. I am still trying to solve the same basic problem with Sage and I am just reporting what I am experiencing.
F = lambda z: (1/pi)*integral((x-1)^z*sqrt(1/x-1/4), x,0,4)
print F(1/2).n()
NaN
print F(3/2).n()
0.509025648974361 Exception ValueError: ValueError('negative number to a fractional power not real',) in 'sage.gsl.integration.c_ff' ignored [The error message some 20 times.]
With Maple:
F := z -> (1/Pi)*int((x-1)^z*sqrt(1/x-1/4), x=0..4);
evalf(F(1/2)); 0.3697166867 + 0.4838248688*I
evalf(F(3/2)); 0.5090256475 - 0.3669993270 IMon, 29 Jun 2015 15:21:52 +0200https://ask.sagemath.org/question/27237/another-problem-with-integral/Comment by rws for <p>This is a follow-up to 'Problem with integral' which is a follow-up of 'Problem with hypergeometric'. I am still trying to solve the same basic problem with Sage and I am just reporting what I am experiencing.</p>
<pre><code>F = lambda z: (1/pi)*integral((x-1)^z*sqrt(1/x-1/4), x,0,4)
print F(1/2).n()
</code></pre>
<p>NaN</p>
<pre><code>print F(3/2).n()
0.509025648974361 Exception ValueError: ValueError('negative number to a fractional power not real',) in 'sage.gsl.integration.c_ff' ignored [The error message some 20 times.]
</code></pre>
<p>With Maple:</p>
<pre><code>F := z -> (1/Pi)*int((x-1)^z*sqrt(1/x-1/4), x=0..4);
evalf(F(1/2)); 0.3697166867 + 0.4838248688*I
evalf(F(3/2)); 0.5090256475 - 0.3669993270 I
</code></pre>
https://ask.sagemath.org/question/27237/another-problem-with-integral/?comment=27242#post-id-27242Note that the solution of the symbolic integration problem with z=1/2 depends on whether the roots are collected:
sage: integral(sqrt(x-1)*sqrt(1/x-1/4))
integrate(sqrt(x - 1)*sqrt(1/x - 1/4), x)
sage: integrate(sqrt(-1/4*x^2 + 5/4*x - 1)/x^2)
-sqrt(-1/4*x^2 + 5/4*x - 1)/x + 1/2*arcsin(-2/3*x + 5/3) + 5/8*arcsin(5/3*x/abs(x) - 8/3/abs(x))
This specific issue is reported as http://trac.sagemath.org/ticket/18822
However, even with the solution the limit of F(4)-F(t), t->0 can't be computed.Tue, 30 Jun 2015 08:34:33 +0200https://ask.sagemath.org/question/27237/another-problem-with-integral/?comment=27242#post-id-27242Comment by Peter Luschny for <p>This is a follow-up to 'Problem with integral' which is a follow-up of 'Problem with hypergeometric'. I am still trying to solve the same basic problem with Sage and I am just reporting what I am experiencing.</p>
<pre><code>F = lambda z: (1/pi)*integral((x-1)^z*sqrt(1/x-1/4), x,0,4)
print F(1/2).n()
</code></pre>
<p>NaN</p>
<pre><code>print F(3/2).n()
0.509025648974361 Exception ValueError: ValueError('negative number to a fractional power not real',) in 'sage.gsl.integration.c_ff' ignored [The error message some 20 times.]
</code></pre>
<p>With Maple:</p>
<pre><code>F := z -> (1/Pi)*int((x-1)^z*sqrt(1/x-1/4), x=0..4);
evalf(F(1/2)); 0.3697166867 + 0.4838248688*I
evalf(F(3/2)); 0.5090256475 - 0.3669993270 I
</code></pre>
https://ask.sagemath.org/question/27237/another-problem-with-integral/?comment=27244#post-id-27244The fact that there is a workaround for a special case does not give comfort as I confined myself in the report to special cases to simplify matters. If you look behind the scene you see the continuous Lah function which should work for all real z>0 at least.Thu, 02 Jul 2015 09:12:31 +0200https://ask.sagemath.org/question/27237/another-problem-with-integral/?comment=27244#post-id-27244