# Backprop error: Complex numbers in neuron weights?

**URL:** <https://discourse.julialang.org/t/backprop-error-complex-numbers-in-neuron-weights/8650>\
**Category:** General Usage\
**Created:** [January 28, 2018, 2:33am UTC](https://discourse.julialang.org/t/backprop-error-complex-numbers-in-neuron-weights/8650 "2018-01-28T02:33:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![y4lu](https://avatars.discourse-cdn.com/v4/letter/y/47e85d/32.png) [@y4lu](https://discourse.julialang.org/u/y4lu)\
**Post date:** [January 28, 2018, 2:33am UTC](https://discourse.julialang.org/t/backprop-error-complex-numbers-in-neuron-weights/8650/1 "2018-01-28T02:33:40Z")

</div>

Any thoughts on how I may have introduced complex numbers into the algorithm by accident?  
Ah it seems to have disappearred now =/ but it was an error like

> minimum(matrixX) ^ 0.2  
> Domain Error: Complex result requires a complex argument  
> [1] in math.jl line 300  
> [2] in math.jl line 699

---

<div class="post-metadata">

**Author:** ![y4lu](https://avatars.discourse-cdn.com/v4/letter/y/47e85d/32.png) [@y4lu](https://discourse.julialang.org/u/y4lu)\
**Post date:** [January 28, 2018, 3:02am UTC](https://discourse.julialang.org/t/backprop-error-complex-numbers-in-neuron-weights/8650/2 "2018-01-28T03:02:18Z")

</div>

![error-capture](https://global.discourse-cdn.com/julialang/original/3X/4/c/4c5d62bb290399d76c58c75fa7b5dc4219d8ff80.png)  
I thought it might be a complex number hiding in the dataset, but it doesn’t seem to be that either

---

<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 28, 2018, 3:12am UTC](https://discourse.julialang.org/t/backprop-error-complex-numbers-in-neuron-weights/8650/3 "2018-01-28T03:12:44Z")

</div>

there’s confusing parsing problem going on in your example. `-2.68e15^0.2` is parsed as `-(2.68e15^0.2)` which exists. Try `(-2.68e15)^0.2` and it’ll error. `(-2)^0.2` is a much easier example. Fractional exponentiation is defined by the complex log function. The easiest example to think of here is that `(-1)^0.5 = sqrt(-1) = im`. So in this domain it cannot be guaranteed to be a real number. It gets even worse because exponentials/logs actually don’t always have unique solutions, so you have to take principle branches and stuff like that. Here’s a blurb:

> **[Exponentiation](https://en.wikipedia.org/wiki/Exponentiation#Real_exponents_with_negative_bases)**
>
> In mathematics, exponentiation is an operation involving two numbers, the base and the exponent or power. Exponentiation is written as bn, where b is the base and n is the power; this is pronounced as "b (raised) to the (power of) n". When n is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, bn is the product of multiplying n bases:
> The exponent is usually shown as a superscript to the right of the base. In that case, bn is called "b raised to th...

But long story short, negative numbers to exponents `<1` are generally defined as complex valued (via applying the complex exponential defined via the principle branch of the complex log), which gives this trouble.
