This work in pure python.

The problem in sage is with the line

s = sin(2*pi*50*t)+sin(2*pi*70*t+pi/4)

However, I don't know how to get Sage to
evaluate the sin of a numpy.ndarray.
For example,

sage: sample_rate=1000.00
sage: import numpy
sage: s=numpy.sin(2*numpy.pi*50*t)+numpy.sin(2*numpy.pi*70*t+numpy.pi/4)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/wdj/.sage/temp/hera/27292/_home_wdj__sage_init_sage_0.py in <module>()

AttributeError: sin




On Sat, Jul 25, 2009 at 4:40 PM, Rafael Cardoso Dias
Costa<rfc...@gmail.com> wrote:
> My problem is sage-support!
>
> Thank!
>
> On Sat, Jul 25, 2009 at 5:38 PM, Rafael Cardoso Dias Costa
> <rfc...@gmail.com> wrote:
>>
>> error message:
>>
>> Traceback (most recent call last):
>>
>>   File "<stdin>", line 1, in <module>
>>   File "/home/sage/sagenb/sage_notebook/worksheets/rfcard/0/code/12.py",
>> line 15, in <module>
>>
>>     S=fft(s)
>>   File "", line 1, in <module>
>>
>>   File
>> "/home/sage/sage_install/sage/local/lib/python2.6/site-packages/numpy/fft/fftpack.py",
>> line 159, in fft
>>     return _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftf, _fft_cache)
>>
>>
>>   File
>> "/home/sage/sage_install/sage/local/lib/python2.6/site-packages/numpy/fft/fftpack.py",
>> line 66, in _raw_fft
>>     r = work_function(a, wsave)
>> TypeError: array cannot be safely cast to required type
>>
>> On Sat, Jul 25, 2009 at 5:29 PM, Rafael Costa <rfc...@gmail.com> wrote:
>>>
>>> Why Sage not execute the python code?
>>>
>>> from scipy import *
>>> from pylab import *
>>>
>>> sample_rate=1000.00
>>> t=r_[0:0.6:1/sample_rate]
>>> N=len(t)
>>> s=sin(2*pi*50*t)+sin(2*pi*70*t+pi/4)
>>> S=fft(s)
>>> f=sample_rate*r_[0:(N/2)]/N
>>> n=len(f)
>>> plot(f,abs(S[0:n])/N)
>>>
>>>
>>> Thank!
>>>
>>>
>>> Rafael
>>>
>>>
>>
>>
>>
>> --
>> Rafael Cardoso Dias Costa
>> Engenheiro de Controle e Automação - UFMG
>> Mestrando em Engenharia Química - Controle de Processos - UFRGS
>> +55 51 8541-0926 :: Porto Alegre - RS
>> +55 51 8430-1421 :: Porto Alegre - RS
>> +55 31 9165-5488 :: Belo Horizonte - MG
>> +55 31 3466-0146 :: Residência em Belo Horizonte - MG
>
>
>
> --
> Rafael Cardoso Dias Costa
> Engenheiro de Controle e Automação - UFMG
> Mestrando em Engenharia Química - Controle de Processos - UFRGS
> +55 51 8541-0926 :: Porto Alegre - RS
> +55 51 8430-1421 :: Porto Alegre - RS
> +55 31 9165-5488 :: Belo Horizonte - MG
> +55 31 3466-0146 :: Residência em Belo Horizonte - MG
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to