Hello there,
this is just something to what i figured out, don't know if someone can
make anything of it.
I have a symbolic exponential function from which i generate discrete
points to plot with matplotlib.
function = self.repo.user_choice.function #Concrete
value: 5.081981 + 94.706663*2.71828182845905**(-0.017908957*t) ;
type(function) -> sympy.core.add.Add
model_plot_data = []
for time_point in self.repo.plot_data.model['t']:
model_plot_data.append(function.subs(t,time_point))
Later, i have to do a numpy.fft.fft on the model_plot_data which results as
a casting error.
data = numpy.array(model_plot_data)
numpy.fft.fft( data ) - > array cannot be safely cast to required type
The problem is with sympy.core.numbers.Float, and the solution which works
is casting all the numbers generated from the symbolic expression to
standard floats.
data_f = []
for num in model_plot_data:
data_f.append( float(num) )
data = numpy.array(data_f)
numpy.fft.fft( data ) -> works
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sympy/-/jRy06Djf05kJ.
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/sympy?hl=en.