I am trying to convert from python to julia, but I don't know how to use 
y1=integrate.odeint(f,t), apparently I should have add a derivativ ?

--python----------------------
from scipy.integrate import odeint
def f(y,t):
    if t<25:
        return [y[1],-8*y[0]+0.1*y[1]]
    elif 25<t<45:
        return [y[1],-8*y[0]]
    else:
        return [y[1],-8*y[0]-0.1*y[1]]
t=np.linspace(0,35,1000)
# start from  y=0.01, y’=0
y1=odeint(f,[0.01,0],t)
plt.plot(t,y1[:,0])
plt.title("Evolution temporelle")
plt.xlabel("Temps t (s)")
plt.ylabel("Intensite i (A)")
plt.plot(0,0.01,"ro")
#plt.savefig("RLC-demarrage.eps")
plt.show()
----------ijulia----------------
@pyimport scipy.integrate as odeint
function f(y,t)
          if t<25
            return [y[1],-8*y[0]+0.1*y[1]]
          elseif 25<t<45
                return [y[1],-8*y[0]]
          else
                return [y[1],-8*y[0]-0.1*y[1]]
          end
end;
t=linspace(0,35,1000)
y=linspace(0.01,0)
y1=integrate.odeint(f,y,t)

Reply via email to