# How to print ODEs after create ODEProblem

**URL:** <https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627>\
**Category:** General Usage\
**Tags:** ode\
**Created:** [May 30, 2023, 7:14pm UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627 "2023-05-30T19:14:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ethan\_Tran](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ethan_tran/32/49198_2.png) [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Post date:** [May 30, 2023, 7:14pm UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627/1 "2023-05-30T19:14:27Z")

</div>

Hi everyone,  
I would like to ask how to print the equations of the system after creating a problem by function ODEProblem() following:

> sys = ODESystem(eqs)  
> prob = ODEProblem(sys,u0,tspan)

I tried to use the equations(prob), but I got the message:

> MethodError: no method matching equations(::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#\_RGF\_ModTag", ModelingToolkit.var"#\_RGF\_ModTag", (0x1c387064, 0x74ec2d83, 0x8ad760c2, 0xdb0e98f0, 0xabc816c2), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#\_RGF\_ModTag", ModelingToolkit.var"#\_RGF\_ModTag", (0x53ba6645, 0x88658262, 0xed4600ac, 0xd28f2b69, 0x1d18b114), Expr}}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#565#generated\_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem})

Please help me on how could I print the equations of system?

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 30, 2023, 7:17pm UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627/2 "2023-05-30T19:17:49Z")

</div>

Try instead:

```julia
equations(sys)

```

I think `sys` is the symbolic form of the equations, while `prob` is the symbolic equations converted to a numeric form.

---

<div class="post-metadata">

**Author:** ![Ethan\_Tran](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ethan_tran/32/49198_2.png) [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Post date:** [May 30, 2023, 7:25pm UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627/3 "2023-05-30T19:25:07Z")

</div>

So, If I want to show the equations in numeric form after creating an ODE problem, there are any functions to do that?

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 30, 2023, 7:39pm UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627/4 "2023-05-30T19:39:53Z")

</div>

What do you mean/expect when you say “equations in numeric form”? I should say that when I write “equations in numeric form”, I don’t really mean equations. I should probably have said a data structure containing conversion of the mathematical equations into a Julia function, in combination with initial states, time span, model parameters, etc.

I’m not a developer, so I don’t know the inner workings of this. The only thing that _might_ be of interest (to me, i.e.), would be to learn how MTK converts symbolic equations into a function containing the model, similar to the function you have to write “manually” if you instead code the function yourself. Anyways, this is not something I would care to do. I think MTK has a method that converts a manually written function of ODEs/DAEs into an MTK model. I don’t know whether there is a method that does the inverse.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 30, 2023, 7:49pm UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627/5 "2023-05-30T19:49:55Z")

</div>

OK – seems like you can do:

```julia
modelingtoolkitize(prob)

```

and this should give you back your `sys`. But you don’t get the actual function that you would write if you code the function manually, see examples from `DifferentialEquations.jl`. Unless there is some options to `modelingtoolkitize`.

---

<div class="post-metadata">

**Author:** ![Ethan\_Tran](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ethan_tran/32/49198_2.png) [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Post date:** [May 30, 2023, 7:52pm UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627/6 "2023-05-30T19:52:28Z")

</div>

Thank you for your information. Because my initial equations are DAEs and I would like to show the equations of the system after converting it into an ODE problem by MTK.

---

<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:** [May 31, 2023, 12:22am UTC](https://discourse.julialang.org/t/how-to-print-odes-after-create-odeproblem/99627/7 "2023-05-31T00:22:20Z")

</div>

Use the `expression` keyword argument.
