# Problem with complex number

1. Dec 24, 2015

### hokhani

One problem I sometimes encounter is with complex numbers. When a formula including functions of complex variables runs in Matlab, I obtain the corresponding result but if I write that formula in different forms (for example when I arrange the long formula in simpler form) I obtain another result. I always check the equality of these formulas and I am confident that they are mathematically the same. I haven't found yet the source of this problem.

2. Dec 24, 2015

### Fightfish

It is difficult to troubleshoot without any specific examples - could you perhaps provide one such instance? Sometimes these issues arise when you perform certain multi-valued complex map operations such as taking the logarithm. In these instances, there may be non-equivalence because these software are automatically programmed to take the principal branch.

3. Dec 24, 2015

### hokhani

In the attached file I have written the two same formulae which give different values numerically.

#### Attached Files:

• ###### Matlab Complex Numbers.pdf
File size:
74.9 KB
Views:
55
4. Dec 24, 2015

### Fightfish

These expressions are hideous. I haven't checked the algebra, but I'm just going to assume they're correct for now. At first glance, I don't think I see anything that could likely cause the issue (unless $q_{I}$ and $q_{II}$ are some funny functions). Especially as the expressions are so ugly, might it have been possible that you've made a small mistake in the code somewhere?
Computer algebra systems like Mathematica would probably help greatly in the troubleshooting as well, since you can trace both the numerics and analytical forms at the same time.