# DIfferential equation problem with DifferentialEquations.jl

#1

I am trying to solve a differential equation with DifferentialEquations.jl but I keep having an issue in the code:

``````g=9.81; t0=10; m=100; J=10; L=0.5
k1=50000; k2=60000; Om=35; em=0.5

M=[m 0; 0 J]
K=[k1+k2 (k2-k1)*L; (k2-k1)*L (k1+k2)*L^2]

using DifferentialEquations

Mi=inv(M)
A=[zeros(M) eye(M);
-Mi*K zeros(M)]

function h12f(t,y)
F=em*Om^2*cos(Om*t)
h=[F; 0]
b=[0; 0; Mi*h]
return A*y+b
end

t=(0,0,t0)
y0=zeros(4)

prob = ODEProblem(h12f,y0,t)
sol = solve(prob,saveat=0.01)
``````

And the error says:

LoadError: MethodError: cannot â€˜convertâ€™ an object of type Tuple{Int64} to an object of type{}

The error is located on the same line where the ODEProblem -command is, so is the command trying to change the type of Tuple t or something? Anyone more experienced having suggestions how to fix this?

#2

`t=(0,0,t0)` needs to be `t=(0.0,t0)` (as per the comment on SO)

#3

Oh, how could I not notice:expressionless:. But thank you pkofod for your help, the code works now as it should.