# AssertionError: IndexStyle(value) === IndexLinear() in loss function

**URL:** <https://discourse.julialang.org/t/assertionerror-indexstyle-value-indexlinear-in-loss-function/50531>\
**Category:** General Usage\
**Created:** [November 21, 2020, 12:14pm UTC](https://discourse.julialang.org/t/assertionerror-indexstyle-value-indexlinear-in-loss-function/50531 "2020-11-21T12:14:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![praveen](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@praveen](https://discourse.julialang.org/u/praveen)\
**Post date:** [November 21, 2020, 12:14pm UTC](https://discourse.julialang.org/t/assertionerror-indexstyle-value-indexlinear-in-loss-function/50531/1 "2020-11-21T12:14:37Z")

</div>

please anyone help me out  
not able to debug  
here is the code  
trying to create data on second order ode and then passing random parameter in equation and applying DiffEqFlux.sciml\_train to predict parameter  
using DifferentialEquations  
using DiffEqFlux

using Optim  
po=1.01325_10^5  
s=.0728  
ro=2.0e-6  
D=200.0e-6  
rho=1000.0  
pv=2.33_10^3  
gama=4/3  
h=ro/8.86  
c=1500.0  
vis=.001002  
omega=(2_22_20_10^3)/7  
pa=(-1.4)po  
yo=ro  
c1=(po+(2s/ro))ro^(3gama)/rho  
c2=po/rho  
c3=pa/rho  
c4=4_vis/rho  
c5=2_s/rho  
c6=1.5  
u0 = [0.0,rho]  
tsp=(0.0, 40.0e-6)  
p=[c1,c2,c3,c4,c5,c6,omega]  
function radi(ddr,dr,r,p,t)  
α, Γ, β, δ, ε, k,omega = p  
ddr[1]=α/r[1]^(3_gama+1) - Γ/r[1] - β_sin(omega_t)/r[1] - δ_dr[1]/r[1]^2 - ε/r[1]^2 -k_dr[1]^2/r[1]  
end

prob2 = SecondOrderODEProblem(radi, [0.], [ro], (0, 26.4e-6), p)  
sol2 = solve(prob2, Tsit5(),saveat=1.0e-7)  
data=Array(sol2)  
using Plots  
a=sol2[2,:]  
plot(a)

pinit=[2.7e-10,10,1,4,1,1,omega]  
function loss(p)

```
    tmp_prob=SecondOrderODEProblem(radi, [0.], [ro], (0, 26.4e-6), p)
    tmp_sol=solve(tmp_prob,Tsit5(),saveat=1.0e-7)
    sum(abs2,Array(tmp_sol)-data),tmp_sol

```

end

res=DiffEqFlux.sciml\_train(loss,p,BFGS())
