Why am i getting an array instead of a number

In particular, the variable omega seems to be crucial here. It’s probably an array, and you haven’t defined it. The fact that abs2. is called with a dot, indicates that whoever wrote the code expects it to be an array.