neurophysik / jitcdde

Just-in-time compilation for delay differential equations
Other
56 stars 14 forks source link

AttributeError: 'RealDouble' object has no attribute 'real_part' #17

Closed softimpulse closed 5 years ago

softimpulse commented 5 years ago

Might be this is just a simple usage error, a simple python test script throws an error:

Traceback (most recent call last):
  File "test.py", line 14, in <module>
    DDE.step_on_discontinuities()
  File "/home/ms/.local/lib/python3.6/site-packages/jitcdde/_jitcdde.py", line 906, in step_on_discontinuities
    for delay in self.delays
  File "/home/ms/.local/lib/python3.6/site-packages/jitcdde/_jitcdde.py", line 906, in <listcomp>
    for delay in self.delays
AttributeError: 'RealDouble' object has no attribute 'real_part'

my testfile is:

from jitcdde import jitcdde, y, t
import numpy

τ = 15
n = 10
β = 0.25
γ = 0.1

f = [ β * y(0,t-τ) / (1 + y(0,t-τ)**n) - γ*y(0) ]
DDE = jitcdde(f)

DDE.constant_past([1.0])

DDE.step_on_discontinuities()

data = []
for time in numpy.arange(DDE.t, DDE.t+10000, 10):
    data.append( DDE.integrate(time) )
numpy.savetxt("timeseries.dat", data)

And I am using newest versions by compiling from source with:

sudo apt install python3-numpy libgmp-dev  python3-pip cython3
sudo -H pip3 install --upgrade scipy sympy # mit oder ohne macht keinen Unterschied

git clone https://github.com/symengine/symengine.git && \
cd symengine/ && \
cmake . && \
make -j4 && \
sudo make install
# i'm going to install system wide
sudo -H pip3 install --upgrade git+git://github.com/symengine/symengine.py
# grab some coffee
sudo -H pip3 install --upgrade git+git://github.com/neurophysik/jitcxde_common git+git://github.com/neurophysik/jitcode git+git://github.com/neurophysik/jitcdde git+git://github.com/neurophysik/jitcsde
Wrzlprmft commented 5 years ago

This seems to be a problem with some update of SymEngine. While I am trying to figure out the details and how to deal with them, you can solve your problem by installing the development version from PyPI via:

pip3 install symengine==0.3.1.dev1 --force-reinstall
softimpulse commented 5 years ago

Working now, THANKS!

I just had to use a slightly different command:

pip3 install -I symengine==0.3.1.dev1