# Variables multiplication with JuMP.jl

**URL:** <https://discourse.julialang.org/t/variables-multiplication-with-jump-jl/65661>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [August 2, 2021, 7:41am UTC](https://discourse.julialang.org/t/variables-multiplication-with-jump-jl/65661 "2021-08-02T07:41:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ver\_kh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ver_kh/32/27595_2.png) [@ver\_kh](https://discourse.julialang.org/u/ver_kh)\
**Post date:** [August 2, 2021, 7:41am UTC](https://discourse.julialang.org/t/variables-multiplication-with-jump-jl/65661/1 "2021-08-02T07:41:02Z")

</div>

Hi all,  
I’m trying to multiply three JuMP variables within a function but getting an error:  
LoadError: Cannot multiply a quadratic expression by a variable

Here is the simplified version of code:

```julia
using JuMP, Ipopt

f(x,u) = x[1] * u[1] * x[2]

model = Model(Ipopt.Optimizer)
n = 20
@variables(model, begin
    0 <= x[1:n] <= 100          
    0<= u[1:n] <= 1
end)

println(f(x,u))

```

Is there any way to do this kind of multiplication with variables?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 2, 2021, 8:40am UTC](https://discourse.julialang.org/t/variables-multiplication-with-jump-jl/65661/2 "2021-08-02T08:40:30Z")

</div>

Hi there!

> Is there any way to do this kind of multiplication with variables?

Use the nonlinear syntax:

> **[Nonlinear Modeling (Legacy) · JuMP](https://jump.dev/JuMP.jl/stable/manual/nlp/)**
>
> Documentation for JuMP.

Make sure to read the documentation carefully, because there are lots of differences to linear/quadratic syntax.
