# Please help me with my optimal power flow problem

**URL:** <https://discourse.julialang.org/t/please-help-me-with-my-optimal-power-flow-problem/31211>\
**Category:** General Usage\
**Tags:** question, homework\
**Created:** [November 18, 2019, 7:16am UTC](https://discourse.julialang.org/t/please-help-me-with-my-optimal-power-flow-problem/31211 "2019-11-18T07:16:09Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [November 18, 2019, 9:02am UTC](https://discourse.julialang.org/t/please-help-me-with-my-optimal-power-flow-problem/31211/3 "2019-11-18T09:02:25Z")

</div>

Welcome to the Julia Discourse! You’ve posted quite a bit of code for people to go through, you might want to consider checking out [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757) and follow the tips there to amend your question to increase the chance of getting help quickly.

With that said, your code errors because you are trying to convert a complex number into a floating point number somewhere, which doesn’t work. An MWE for this would be:

```julia
julia> a = 1.0 + 1im
1.0 + 1.0im

julia> typeof(a)
Complex{Float64}

julia> Float64(a)
ERROR: InexactError: Float64(1.0 + 1.0im)
Stacktrace:
 [1] Float64(::Complex{Float64}) at .\complex.jl:37
 [2] top-level scope at REPL[3]:100  

```

You would therefore have to think about where this conversion happens and why.

Also, while it is fine to ask for help with your homework here on Discourse, you might want to have a look at our informal homework policy here: [Homework policy - #17 by Tamas\_Papp](https://discourse.julialang.org/t/homework-policy/2342/17)

---

_[View the full topic](https://discourse.julialang.org/t/please-help-me-with-my-optimal-power-flow-problem/31211)._
