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.Tue, 19 May 2015 14:09:42 +0200'negative number to a fractional power not real' while computing inegralhttps://ask.sagemath.org/question/26872/negative-number-to-a-fractional-power-not-real-while-computing-inegral/ Hi
I want to compute the following integral:
B=40
Ef=1.13*10^(-18)
KT=4.03*10^(-21)
mu=1.732*9.27*10^(-24)
f(t)=(sin(t)*(cos(t))^(3/2))/(exp((B*mu*cos(t)-Ef)/KT)+1)
numerical_integral(f,0,pi)
However, it gives me an error
"Exception ValueError: ValueError('negative number to a fractional power
not real',) in 'sage.gsl.integration.c_ff' ignored"
Can somebody resolve this?
Thanks and regards
Ajit Kumar
Tue, 19 May 2015 10:38:31 +0200https://ask.sagemath.org/question/26872/negative-number-to-a-fractional-power-not-real-while-computing-inegral/Answer by calc314 for <p>Hi</p>
<p>I want to compute the following integral:</p>
<pre><code>B=40
Ef=1.13*10^(-18)
KT=4.03*10^(-21)
mu=1.732*9.27*10^(-24)
f(t)=(sin(t)*(cos(t))^(3/2))/(exp((B*mu*cos(t)-Ef)/KT)+1)
numerical_integral(f,0,pi)
</code></pre>
<p>However, it gives me an error </p>
<pre><code>"Exception ValueError: ValueError('negative number to a fractional power
not real',) in 'sage.gsl.integration.c_ff' ignored"
</code></pre>
<p>Can somebody resolve this?</p>
<p>Thanks and regards
Ajit Kumar</p>
https://ask.sagemath.org/question/26872/negative-number-to-a-fractional-power-not-real-while-computing-inegral/?answer=26876#post-id-26876Since $\cos(t)$ is negative for $\pi/2 < t \le \pi$, computing with $(\cos(t))^{3/2}$ is an issue. I do not think `numerical_integral` will handle complex values, but I could be wrong.
Tue, 19 May 2015 14:09:42 +0200https://ask.sagemath.org/question/26872/negative-number-to-a-fractional-power-not-real-while-computing-inegral/?answer=26876#post-id-26876