# Finding limit cycles using the PyDSTool wrapper

**URL:** https://discourse.julialang.org/t/finding-limit-cycles-using-the-pydstool-wrapper/16123
**Category:** New to Julia
**Created:** [October 10, 2018, 3:36pm UTC](https://discourse.julialang.org/t/finding-limit-cycles-using-the-pydstool-wrapper/16123 "2018-10-10T15:36:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![PotatoDynamics](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@PotatoDynamics](https://discourse.julialang.org/u/PotatoDynamics)
#### Post date: [October 10, 2018, 3:36pm UTC](https://discourse.julialang.org/t/finding-limit-cycles-using-the-pydstool-wrapper/16123/1 "2018-10-10T15:36:37Z")

</div>

Hello everyone,

I am relatively new to Julia and I need help putting the PyDSTool to use. Unfortunately, the PyDSTool-documentation is quite sparse and lacks examples.  
I have a system of nonlinear differential equations - defined using the @ode\_def-macro - describing the dynamics of a harmonically excited shell structure. I want to find stable, periodic solutions with the excitation force (f\_N) and frequency (ome\_N) as bifurcation parameters.  
Following the instructions at [http://docs.juliadiffeq.org/latest/analysis/bifurcation.html](http://docs.juliadiffeq.org/latest/analysis/bifurcation.html), this should perform the computations:

```julia
u0 = zeros(18);
tspan = [0;30];
p = [0.0,0.3*2*pi*952.26];`

```

`dsargs = build_ode(EOM_nd_9p,u0,tspan,p) `

```julia
ode = ds[:Generator][:Vode_ODEsystem](dsargs)
ode[:set](pars = Dict("ome_N"=0.3*2*pi*952.26)) 
ode[:set](pars = Dict("f_N"=>0.0))
PC = ds[:ContClass](ode)

```

Everything works fine until here.

```julia
bif = bifurcation_curve(PC,"LC-C",["f_N","ome_N"],
                        max_num_points=450,
                        max_stepsize=2,min_stepsize=1e-5,
                        stepsize=2e-2,loc_bif_points="all",
                        save_eigen=true,name="LC1",
                        print_info=true,calc_stab=true)

```

When I try to run this, I get the following error, that I already investigated but could not find a solution to:

```julia
ERROR: PyError ($(Expr(:escape, :(ccall(#= C:\Users\Martin\.julia\packages\PyCall\rUul9\src\pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'OSError'>
OSError(OSError(22, 'Invalid argument'),)
  File "C:\Users\Martin\.julia\packages\Conda\hsaaN\deps\usr\lib\site-packages\PyDSTool\PyCont\ContClass.py", line 212, in newCurve
    self.loadAutoMod()
  File "C:\Users\Martin\.julia\packages\Conda\hsaaN\deps\usr\lib\site-packages\PyDSTool\PyCont\ContClass.py", line 423, in loadAutoMod
    self.makeAutoLibSource()
  File "C:\Users\Martin\.julia\packages\Conda\hsaaN\deps\usr\lib\site-packages\PyDSTool\PyCont\ContClass.py", line 611, in makeAutoLibSource
    raise IOError(e)

```

If someone has any experience with the usage of PyDSTool to share or knows how to resolve this problem, I would be very grateful.

My equations of motion:

```julia
EOM_nd_9p = @ode_def Shell9 begin

	du11 = v1;
	dv11 = v2;
	du13 = v3;
	dv13 = v4;
	du31 = v5;
	dv31 = v6;
	du33 = v7;
	dv33 = v8;
	dw11 = v9;
	
	dv1 = v1*(-2.0e-5)+w11*pi*4.160672128228474e2+(w11^2)*pi*1.678493371387897e2-(pi^2)*u11*4.320697979314184e3-(pi^2)*v11*2.080336064114237e3;
	dv2 = v2*(-2.0e-5)+w11*pi*4.160672128228474e2+(w11^2)*pi*1.678493371387897e2-(pi^2)*u11*2.080336064114237e3-(pi^2)*v11*4.320697979314184e3;
	dv3 = v3*(-5.410077079789133e-5)-(w11^2)*pi*6.543279244393497e1-(pi^2)*u13*1.328214564011397e4-(pi^2)*v13*6.241008192342711e3;
	dv4 = v4*(-5.410077079789133e-5)-(w11^2)*pi*1.007096022832738e2-(pi^2)*u13*6.241008192342711e3-(pi^2)*v13*2.992483415302787e4;
	dv5 = v5*(-5.410077079789133e-5)-(w11^2)*pi*1.007096022832738e2-(pi^2)*u31*2.992483415302787e4-(pi^2)*v31*6.241008192342711e3;
	dv6 = v6*(-5.410077079789133e-5)-(w11^2)*pi*6.543279244393497e1-(pi^2)*u31*6.241008192342711e3-(pi^2)*v31*1.328214564011397e4;
	dv7 = v7*(-9.393022913910067e-5)+(w11^2)*pi*3.925967546636098e1-(pi^2)*u33*3.888628181382766e4-(pi^2)*v33*1.872302457702813e4;
	dv8 = v8*(-9.393022913910067e-5)+(w11^2)*pi*3.925967546636098e1-(pi^2)*u33*1.872302457702813e4-(pi^2)*v33*3.888628181382766e4;
	dv9 = v9*(-2.0e-5)-(w11^2)*8.876100540220744e1-w11*8.321344256456948e1+u11*pi*4.160672128228474e2+v11*pi*4.160672128228474e2-(pi^4)*w11*1.06683900723807e-1+f_N*cos(ome_N*t*1.050133366937601e-3)*5.655282504388217e-2+u11*w11*pi*3.356986742775794e2+v11*w11*pi*3.356986742775794e2-u13*w11*pi*1.308655848878699e2-v13*w11*pi*2.014192045665477e2-u31*w11*pi*2.014192045665477e2-v31*w11*pi*1.308655848878699e2+u33*w11*pi*7.851935093272197e1+v33*w11*pi*7.851935093272197e1-(w11^2)*(pi^4)*w11*2.480400691828513e-1;

end f_N ome_N

```

---

<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: [October 10, 2018, 4:04pm UTC](https://discourse.julialang.org/t/finding-limit-cycles-using-the-pydstool-wrapper/16123/2 "2018-10-10T16:04:50Z")

</div>

[https://github.com/JuliaDiffEq/PyDSTool.jl/issues/11#issuecomment-428629682](https://github.com/JuliaDiffEq/PyDSTool.jl/issues/11#issuecomment-428629682)

It could just be that AUTO isn’t installed.
