# How can you call a function inside a taylor model function for reachability analysis?

**URL:** https://discourse.julialang.org/t/how-can-you-call-a-function-inside-a-taylor-model-function-for-reachability-analysis/119945
**Category:** General Usage
**Tags:** functions, reachabilityanalysis
**Created:** [September 27, 2024, 10:20am UTC](https://discourse.julialang.org/t/how-can-you-call-a-function-inside-a-taylor-model-function-for-reachability-analysis/119945 "2024-09-27T10:20:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Muhammad\_Arsal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/muhammad_arsal/32/212269_2.png) [@Muhammad\_Arsal](https://discourse.julialang.org/u/Muhammad_Arsal)
#### Post date: [September 27, 2024, 10:20am UTC](https://discourse.julialang.org/t/how-can-you-call-a-function-inside-a-taylor-model-function-for-reachability-analysis/119945/1 "2024-09-27T10:20:22Z")

</div>

I am using Jupyter Notebook. And I have a grid interploation function. Which gives me the value of a variable based upon the data of other two. But the problem is when I try to run reachability analysis, it starts throwing an error.  
MethodError: MethodError: no method matching isless(::Float64, ::TaylorModel1{TaylorN{Float64}, Float64})

---

<div class="post-metadata">

### Author: ![Muhammad\_Arsal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/muhammad_arsal/32/212269_2.png) [@Muhammad\_Arsal](https://discourse.julialang.org/u/Muhammad_Arsal)
#### Post date: [September 28, 2024, 10:51pm UTC](https://discourse.julialang.org/t/how-can-you-call-a-function-inside-a-taylor-model-function-for-reachability-analysis/119945/3 "2024-09-28T22:51:39Z")

</div>

But when I tried to put the constant terms into the function It did not run and gave an error that the function is not defined.

---

<div class="post-metadata">

### Author: ![Muhammad\_Arsal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/muhammad_arsal/32/212269_2.png) [@Muhammad\_Arsal](https://discourse.julialang.org/u/Muhammad_Arsal)
#### Post date: [September 29, 2024, 9:46am UTC](https://discourse.julialang.org/t/how-can-you-call-a-function-inside-a-taylor-model-function-for-reachability-analysis/119945/4 "2024-09-29T09:46:12Z")

</div>

``  
using Interpolations  
function interpol(x,y)  
local TSR = [3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10] # Add your TSR values here  
local B = -30:1:30 # This creates a range, convert it to an array if needed

#Define the Cp values (this is the lookup table)  
#The rows correspond to TSR values and the columns to B values  
local Cp = […] #15x61 matrix. You may take any rand values

#convert Cp to a matrix (make sure it has correct dimensions)  
Cp = reshape(Cp, length(TSR), length(B))

#Create an interpolation object  
itp = interpolate((x, y), Cp, Gridded(Linear()))  
return itp  
end  
using ReachabilityAnalysis  
@taylorize function mymodel!(du, u, p, t)  
local j,R,wr,V=3410432,35,2.582,12  
b,w,bd = u  
du[1] = bd - b  
du[2] = (0.5\* 3.14\* R^3\* V^2\* 1.225\* interpol(w_R/V,b)-615139)/j  
du[3] = 21.43_(0.5\* 3.14\* R^3\* V^2\* 1.225\* interpol(w_R/V,b)-615139)/j+5.87_(w-wr)  
return du  
end  
X0 = Hyperrectangle(; low=[2,2.58,2], high=[2,2.58,2])  
prob = @ivp(x’ = mymodel!(x), dim:3, x(0) ∈ X0);  
alg = TMJets(; abstol=1e-20, orderT=10, orderQ=2, maxsteps=500\_000)  
sol = solve(prob; T=200.0, alg=alg)  
solz = overapproximate(sol, Zonotope);  
``
