# Plotting basic bifurcation diagram using DiffEq and BifurcationKit.jl

**URL:** https://discourse.julialang.org/t/plotting-basic-bifurcation-diagram-using-diffeq-and-bifurcationkit-jl/69957
**Category:** General Usage
**Created:** [October 18, 2021, 3:14am UTC](https://discourse.julialang.org/t/plotting-basic-bifurcation-diagram-using-diffeq-and-bifurcationkit-jl/69957 "2021-10-18T03:14:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)
#### Post date: [October 18, 2021, 3:14am UTC](https://discourse.julialang.org/t/plotting-basic-bifurcation-diagram-using-diffeq-and-bifurcationkit-jl/69957/1 "2021-10-18T03:14:09Z")

</div>

I am trying to plot a very basic bifurcation plot of my simple first order ODE.

```julia
using DifferentialEquations
using Gnuplot
using BifurcationKit

# this definition makes the dI a vector so have to send in vector initial conditions 
# model = @ode_def begin
# dI = β*I*(1 - 1/𝕽 - I)
# end β 𝕽
odemodel(I, p, t) = p.β*I*(1 - 1/p.𝕽 - I)
prob = ODEProblem(odemodel, 1.0, (0.0, 500.0), (β = 0.04, 𝕽 = 1.2), jac=true)
sol = solve(prob)

```

I was told the [example here](https://catalyst.sciml.ai/dev/tutorials/bifurcation_diagram/) would help me out but I am not sure how to get the jacobian of my system.

---

<div class="post-metadata">

### Author: ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)
#### Post date: [October 18, 2021, 6:15am UTC](https://discourse.julialang.org/t/plotting-basic-bifurcation-diagram-using-diffeq-and-bifurcationkit-jl/69957/2 "2021-10-18T06:15:11Z")

</div>

The jacobian is given in the link you gave `J = (u,p) -> odefun.jac(u,p,0)`

---

<div class="post-metadata">

### Author: ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)
#### Post date: [October 20, 2021, 5:07pm UTC](https://discourse.julialang.org/t/plotting-basic-bifurcation-diagram-using-diffeq-and-bifurcationkit-jl/69957/3 "2021-10-20T17:07:18Z")

</div>

But I don’t have `odefun`… is that something I can create out of the `ODEProblem` object? For example, `𝕽 = 1.0` is a bifurcation point for a transcritical bifurcation and I was wondering if I could show that using `BifurcationKit.jl`

---

<div class="post-metadata">

### Author: ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)
#### Post date: [October 20, 2021, 5:17pm UTC](https://discourse.julialang.org/t/plotting-basic-bifurcation-diagram-using-diffeq-and-bifurcationkit-jl/69957/4 "2021-10-20T17:17:02Z")

</div>

look at `prob.f.jac`

> is a bifurcation point for a transcritical bifurcation and I was wondering if I could show that using `BifurcationKit.jl`

Please, see [here](https://rveltz.github.io/BifurcationKit.jl/dev/tutorials/ode/tutorialsODE/#Neural-mass-equation-(Hopf-aBS)) for a basic example in BifurcationKit.

To compute the bifurcation diagram (BD), you can

1. use automatic BD (see [here](https://rveltz.github.io/BifurcationKit.jl/dev/tutorials/ode/tutorialPP2/#pp2-example-from-AUTO07p-(aBD-Hopf-aBS)))
2. use deflated continuation (see [here](https://rveltz.github.io/BifurcationKit.jl/dev/DeflatedContinuation/#Basic-example))
