On Sat, 26 Jun 2010 16:01:17 +0200
Tobias Katz <[email protected]> wrote:
> Hi,
>
> I got a first result, but it only works when I "type" it in the
> command line interface.
>
> import numpy as np
> import pylab as pl
>
> pl.ion()
> pl.grid(True)
>
> var('t n_ ll ul')
>
> tt=np.arange(0.01,10,0.01)
>
> f=sin(t)/t
> ts=0.5
> fs=sum(f*dirac_delta(t-(2*n_-1)*ts),n_,0,20)/dirac_delta(0)
>
> fl=lambda t:f
> fl=fl(t)
>
> fsl=lambda t:fs
> fsl=fsl(t)
>
> fslm=map(fsl,tt)
> fsld=np.array(fslm)
> fsld=map(n,fsld)
>
> pl.vlines(tt,[0],fsld)
>
> flm=map(fl,tt)
> fld=np.array(flm)
> fld=map(n,fld)
>
> pl.plot(tt,fld,'--',linewidth=.5)
>
>
>
> When I run it like
> run -i file.py
> I get an error:
>
<snip>
> AttributeError: 'int' object has no attribute '_maxima_'
>
>
> How can I cast these integers to numbers or what is my mistake?
> Is there a better way to do this?
This looks like a bug in the way symbolic sums are handled:
http://trac.sagemath.org/sage_trac/ticket/9393
For a workaround, try renaming your file to have the extension .sage
instead of .py.
BTW, to any developer reading this:
A brief search through the tutorial or the FAQ included in Sage didn't
reveal anything to link to, is there a canonical point to refer to for
these questions? Where is the preparser and differences between Python
and Sage documented?
Cheers,
Burcin
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org