# Using Optim.Options (Syntax)

**URL:** https://discourse.julialang.org/t/using-optim-options-syntax/50930
**Category:** General Usage
**Created:** [November 29, 2020, 10:02am UTC](https://discourse.julialang.org/t/using-optim-options-syntax/50930 "2020-11-29T10:02:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![schubbiaschwilli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schubbiaschwilli/32/9168_2.png) [@schubbiaschwilli](https://discourse.julialang.org/u/schubbiaschwilli)
#### Post date: [November 29, 2020, 10:02am UTC](https://discourse.julialang.org/t/using-optim-options-syntax/50930/1 "2020-11-29T10:02:13Z")

</div>

Hello!  
I am fitting curves with 2 parameters and I’m using Optim.optimize; especially the LBFGS method because there are lower and upper bounds.

—snip—  
Optim.optimize(par → Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1])  
—snap—

This works fine, but now I tried to use the Optim.Options (for example show\_trace) - But I get some errors:

—snip—  
Optim.optimize(par → Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1], Optim.Options(show\_trace=true))  
ERROR: MethodError: objects of type Array{Float64,1} are not callable  
Use square brackets for indexing an Array.  
—snap—

By the way: What is the correct syntax to correctly determine the input, something like  
—snip—  
Optim.optimize(par → Loss(Testdata, par), lower\_bound=[0.005, 0.00001], upper\_bound=[10000.0, 5.0], init\_val=[0.8, 0.1])  
—snap—

Edit:  
This works:  
—snip—  
Optim.optimize(par → Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1], Fminbox(LBFGS()), Optim.Options(show\_trace=true))  
—snap—

Many thanks in advance,  
Holger

---

<div class="post-metadata">

### Author: ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)
#### Post date: [November 30, 2020, 5:22am UTC](https://discourse.julialang.org/t/using-optim-options-syntax/50930/2 "2020-11-30T05:22:43Z")

</div>

Good to know you figured it out without help! Just a comment FWIW, you can use triple backticks (```) for code blocks in your messages on discourse, and even specify the language, so your last edit written as

````bash
```julia
Optim.optimize(par -> Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1], Fminbox(LBFGS()), Optim.Options(show_trace=true))
```

````

would look like

```julia
Optim.optimize(par -> Loss(Testdata, par), [0.005, 0.00001], [10000.0, 5.0], [0.8, 0.1], Fminbox(LBFGS()), Optim.Options(show_trace=true))

```
