Complex numbers in the mix

Hi, I am modelling a function that uses complex numbers. I want to be able to do math but it seems like complex types aren’t mixing with other types like ints and doubles. for instance, using a complex number in an equation which also has non-complex numbers and it’s almost as if it wants me to have every single number be officially a complex type to be able to let them interact. Is this true? if so, what is the best workflow when using them? can someone point me to resources or examples where ints and complex numbers are interacting well?
thank you

Hi @micron

Operators like addition and multiplication do work with mixed inputs of complex and integer/number types. It treats the non-complex number inputs as complex numbers with the number as the real part, and a zero imaginary part.

Do you have an example where it’s not behaving as expected?

unless you mean in expressions?
There you do have to convert an int to a complex before you can add it to another complex
You can create a new complex by writing it in the form {a,b}
It looks like there’s also a little oddity where you can’t simply plug in an input name, but need to multiply it by 1 to get this conversion to work.

ok that is really helpful. thank you. I am still not doing something right though. here is what it looks like

oh nevermind… I did {u1,0}{e1,0}^(i{v*1,0}) in expression and this works. Thank you

1 Like