# Write a 2ndOrderODEProblem

**URL:** <https://discourse.julialang.org/t/write-a-2ndorderodeproblem/66815>\
**Category:** New to Julia\
**Tags:** question, diffeq\
**Created:** [August 22, 2021, 8:10pm UTC](https://discourse.julialang.org/t/write-a-2ndorderodeproblem/66815 "2021-08-22T20:10:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paolo\_Jara](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paolo_jara/32/25685_2.png) [@Paolo\_Jara](https://discourse.julialang.org/u/Paolo_Jara)\
**Post date:** [August 22, 2021, 8:10pm UTC](https://discourse.julialang.org/t/write-a-2ndorderodeproblem/66815/1 "2021-08-22T20:10:37Z")

</div>

Hi, I am trying to solve the following problem with DifferentialEquations, but when I run my code it does not come out. I don’t know what is wrong, I hope you can help me.

f(x,t)=-2 \ddot{x} + 0.2\dot{x} - 2x + 4

```nohighlight
	f(ddx,dx,x,p,t) = 2 * ddx + 0.2 * dx - 2 * x
	x_0 = 1
	dx_0= 2
	time= (0,1)
	prob=SecondOrderODEProblem(f,x_0,dx_0,time, 4)
	solve(prob, DPRKN6())
```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [August 22, 2021, 10:20pm UTC](https://discourse.julialang.org/t/write-a-2ndorderodeproblem/66815/2 "2021-08-22T22:20:20Z")

</div>

You have to use the out-of-place form with scalars:

```julia
using OrdinaryDiffEq
f(dx,x,p,t) = (0.2 * dx - 2 * x)/2
x_0 = 1
dx_0= 2
time= (0,1)
prob=SecondOrderODEProblem(f,x_0,dx_0,time, 4)
solve(prob, DPRKN6())

```
