Possibly related to How Define a Complex JuMP Variable

I’m wondering if it’s possible to define objective functions and/or constraint functions take take in *real* variables and return a real number (i.e. f(x): ℝ^n → ℝ) but internally use some complex number arithmetic.

Let’s say we wish to solve the following simple system of equations

min θ

s.t. |e^{iθ} +1| = 0

where 0≤θ≤2π.

With JuMP, I’d write this as

```
@variable(model, 0 <= θ <= 2π)
@objective(model, Min, θ)
@constraint(model, con, abs(exp(im*θ) +1) == 0)
```

but that gives me an error `ERROR: InexactError: Float64(im)`

. Is there no way to express a function like this?