On 2016-05-31, Peter Luschny <peter.lusc...@gmail.com> wrote: > def T(v): > def f(t): return (tanh(exp(i*t))/exp(i*t*v)).real() > c = integral_numerical(f(t), 0, 2*pi)[0] > return (c*gamma(v+1)/(2*pi)).n() > > print [round(T(n)) for n in range(10)] > > Sage returned: [0, 1, 0, -1, 0, 8, 0, -136, 0, 3968] > I expected: [0, 1, 0, -2, 0, 16, 0, -272, 0, 7936]
With Maxima built from recent source (approximately Maxima 5.38), I get results that agree with what you expected: for v:0 thru 9 do print(float(gamma(v+1)/(2*%pi)*first(quad_qags(f(t),t,0,2*%pi)))); => - 4.417437057588218E-17 1.0 - 5.300924469105862E-17 - 1.99999999999998 - 6.361109362927033E-16 15.99999999999981 3.180554681463517E-15 - 271.9999999999945 6.055776113506536E-12 7936.000000000022 My first guess is that the real part was being computed incorrectly and now it's fixed. For realpart(tanh(exp(%i*t))/exp(%i*t*v)) I get: (sin(5*t)*sin(2*sin(t)))/(cos(2*sin(t))+cosh(2*cos(t))) +(cos(5*t)*sinh(2*cos(t)))/(cos(2*sin(t))+cosh(2*cos(t))) Are you getting something different for that? If so maybe that explains the difference. I guess I'm also assuming that Sage punts to Maxima for real() here. But integral_numerical is probably not calling Maxima, right? best Robert Dodier -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.