# Define an ODE which depends on an external function with the @ode\_def macro

**URL:** <https://discourse.julialang.org/t/define-an-ode-which-depends-on-an-external-function-with-the-ode-def-macro/98067>\
**Category:** Numerics\
**Tags:** question, differentialequation\
**Created:** [April 28, 2023, 10:42pm UTC](https://discourse.julialang.org/t/define-an-ode-which-depends-on-an-external-function-with-the-ode-def-macro/98067 "2023-04-28T22:42:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 6, 2023, 12:21am UTC](https://discourse.julialang.org/t/define-an-ode-which-depends-on-an-external-function-with-the-ode-def-macro/98067/2 "2023-05-06T00:21:28Z")

</div>

This is a duplicate of another thread which has the answer:

> [@How to define a system of ODEs with @ode\_def and update the value of a variable using a function that depends on time?](https://discourse.julialang.org/t/how-to-define-a-system-of-odes-with-ode-def-and-update-the-value-of-a-variable-using-a-function-that-depends-on-time/98404/2):
>
> You need to @register\_symbolic it so that way it’s kept as a node in the symbolic graph. using DifferentialEquations using ParameterizedFunctions # Solve odeFB odeFB = @ode\_def begin dGp = ((Vmax \* Ge \* Gp)/(Km + Gp)) - (k4 \* Gp) - (k2 \* A \* Gp) + (km2 \* A) + (km4 \* Gi) dGi = (k4 \* Gp) - (k5 \* Gi) - (km4 \* Gi) + (km5 \* A) dA = - (k3 \* A) + (k5 \* Gi) - (km5 \* A) end Vmax Ge Km k2 k3 k4 k5 km2 km4 km5 x0 = ones(length(odeFB.syms)) p = (1400, 24.15, 1100, 5.3, 4, 2, 2.3, 5.3, 2, 2.…

---

_[View the full topic](https://discourse.julialang.org/t/define-an-ode-which-depends-on-an-external-function-with-the-ode-def-macro/98067)._
