# Importance of offset

**URL:** <https://discourse.julialang.org/t/importance-of-offset/54170>\
**Category:** Modelling & Simulations\
**Created:** [January 29, 2021, 8:58am UTC](https://discourse.julialang.org/t/importance-of-offset/54170 "2021-01-29T08:58:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruchitha\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@Ruchitha\_Kumar](https://discourse.julialang.org/u/Ruchitha_Kumar)\
**Post date:** [January 29, 2021, 8:58am UTC](https://discourse.julialang.org/t/importance-of-offset/54170/1 "2021-01-29T08:58:46Z")

</div>

What does the offset 20 signify in the below code?

using ModelingToolkit

@variables x y z  
@parameters a b c

----Define a nonlinear system  
eqs = [0 ~ - y - (z+20),  
0 ~ x + a \* y,  
0 ~ b + (z+20) \* (x - c)]  
ns = NonlinearSystem(eqs, [x,y,z], [a,b,c])  
nlsys\_func = generate\_function(ns)[2] # second is the inplace version

rossler = ModelingToolkit.eval(nlsys\_func)  
du = zeros(3); u = ones(3)  
params = (0.2,0.2,5.7)

j\_func2 = generate\_jacobian(ns)[2] # second is in-place  
j2! = ModelingToolkit.eval(j\_func2)

using NLsolve  
nlsolve((out, x) → rossler(out, x, params), (out, x) → j2!(out, x, params), ones(3))

out:

Results of Nonlinear Solver Algorithm

- Algorithm: Trust-region with dogleg and autoscaling
- Starting Point: [1.0, 1.0, 1.0]
- Zero: [0.007026204834100122, -0.035131024170500603, -19.9648689758295]
- Inf-norm of residuals: 0.000000
- Iterations: 8
- Convergence: true
  - |x - x’| \< 0.0e+00: false
  - |f(x)| \< 1.0e-08: true

- Function Calls (f): 9
- Jacobian Calls (df/dx): 9

---

<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:** [January 29, 2021, 10:46am UTC](https://discourse.julialang.org/t/importance-of-offset/54170/2 "2021-01-29T10:46:55Z")

</div>

What do you mean? The `+20`? It means it’s `+20` in the sample code?

---

<div class="post-metadata">

**Author:** ![Ruchitha\_Kumar](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@Ruchitha\_Kumar](https://discourse.julialang.org/u/Ruchitha_Kumar)\
**Post date:** [January 29, 2021, 10:48am UTC](https://discourse.julialang.org/t/importance-of-offset/54170/3 "2021-01-29T10:48:33Z")

</div>

Yes,  
is that given for the verification of the roots?

---

<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:** [January 29, 2021, 10:54am UTC](https://discourse.julialang.org/t/importance-of-offset/54170/4 "2021-01-29T10:54:07Z")

</div>

It’s just to make the test a bit non-trivial
