# Constructor for SplitFunction SplitODEProblem

**URL:** <https://discourse.julialang.org/t/constructor-for-splitfunction-splitodeproblem/39854>\
**Category:** General Usage\
**Tags:** diffeq\
**Created:** [May 20, 2020, 8:08pm UTC](https://discourse.julialang.org/t/constructor-for-splitfunction-splitodeproblem/39854 "2020-05-20T20:08:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mleprovost](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mleprovost/32/7166_2.png) [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Post date:** [May 20, 2020, 8:08pm UTC](https://discourse.julialang.org/t/constructor-for-splitfunction-splitodeproblem/39854/1 "2020-05-20T20:08:20Z")

</div>

Hello,

I am looking for a constructor for `SplitFunction` for `SplitODEProblem` in DifferentialEquations.jl [https://docs.sciml.ai/latest/types/split\_ode\_types/](https://docs.sciml.ai/latest/types/split_ode_types/)

Given `f1` and `f2`, how do you define the corresponding `SplitFunction`. Here is an example of what I would like to do:

```julia
using ApproxFun
using DifferentialEquations
S = Fourier(0..16*π)
n = 128
x = points(S, n)
D2 = Derivative(S,2)[1:n,1:n]
D = (Derivative(S) → S)[1:n,1:n]
T = ApproxFun.plan_transform(S, n)
Ti = ApproxFun.plan_itransform(S, n)
D4 = Derivative(S,4)[1:n,1:n]

û₀ = T*(cos.(x/16).*(1 .+ sin.(x/16)))
tmp=similar(û₀)
q = (D,T,Ti,tmp,similar(tmp),similar(tmp))

function kuramoto_sivashinsky(dû,û,q,t)
    D,T,Ti,tmp,u,uc = q
    mul!(u, D, û)
    mul!(tmp, Ti, u)
    mul!(u, Ti, û)
    @. tmp=tmp*u
    mul!(u,T, tmp)
    #mul!(uc, D2, û)
    @. dû = - u
end

prob = SplitODEProblem(DiffEqArrayOperator(-Diagonal(D4+D2)), kuramoto_sivashinsky, û₀, (0.0,300.0), q)

# What I would like to do
f = SplitFunction(DiffEqArrayOperator(-Diagonal(D4+D2)), kuramoto_sivashinsky)
prob = SplitODEProblem(f, û₀, (0.0,300.0), q)

sol = solve(prob,ETDRK4(), dt = 0.01)

```

---

<div class="post-metadata">

**Author:** ![SebastianM-C](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastianm-c/32/2480_2.png) [@SebastianM-C](https://discourse.julialang.org/u/SebastianM-C)\
**Post date:** [May 20, 2020, 9:31pm UTC](https://discourse.julialang.org/t/constructor-for-splitfunction-splitodeproblem/39854/2 "2020-05-20T21:31:11Z")

</div>

What is the problem with using the code below the “What I would like to do” comment?  
Defining `prob` like that works and gives the same results as the first attempt.

---

<div class="post-metadata">

**Author:** ![mleprovost](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mleprovost/32/7166_2.png) [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Post date:** [May 20, 2020, 10:27pm UTC](https://discourse.julialang.org/t/constructor-for-splitfunction-splitodeproblem/39854/4 "2020-05-20T22:27:20Z")

</div>

Sorry, there was a bug somewhere.
