Hello Aaron,
Thank you so much for the help. I only dig out SymPy about once a year so
am not as familiar with it as I would like.
I have attached updated code with alterations that you suggested. The
formulation is slightly different (and simpler). The values I get for odd
values of N look right now - they converge in a sensible fashion and match
what I expect for this problem (You can see as N increases they tend
towards ~0.1). However the even values of N do not look right - they
oscillate about 0 as I increase the number of terms in the series. They
should all be positive and follow the even values. Adding extra precision
with evalf() did not seem to help.
I guess at this point it's actually to do with the properties of the sinc
integral, but thought I should check that I'm not doing something stupid
(again)!
Thanks again,
Toby
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/2e5b13a0-bbf9-4334-80b5-6d6e4ca8b56c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# coding: utf-8
from sympy import *
#import numpy as np
init_printing()
t0, N, t = symbols('t_0 N t', real=True)
Si_t = Si(pi*t/t0).series(t, 0, 63).removeO()
Si_f = Si(pi*N)
iSi_t = integrate(Si_t, (t, 0, N*t0))
Av = iSi_t / (Si_f*N*t0)
frac = 2*(1 - Av)
print 'N =', 1, 'frac = ', frac.subs(N, 1).evalf(50)
print 'N =', 2, 'frac = ', frac.subs(N, 2).evalf(50)
print 'N =', 3, 'frac = ', frac.subs(N, 3).evalf(50)
print 'N =', 4, 'frac = ', frac.subs(N, 4).evalf(50)
print 'N =', 5, 'frac = ', frac.subs(N, 5).evalf(50)
print 'N =', 6, 'frac = ', frac.subs(N, 6).evalf(50)
print 'N =', 7, 'frac = ', frac.subs(N, 7).evalf(50)