Proektsoftbg / Calcpad

Free and open source software for mathematical and engineering calculations.
https://calcpad.eu
MIT License
323 stars 39 forks source link

Assignment of complex number with unit to variables #195

Closed ThomsonTanminxin closed 9 months ago

ThomsonTanminxin commented 9 months ago

When I assign a complex number with unit to a variable, the imaginary is gone, only the real part remains. For example, when I input Z=(1+2i) Ω, the output window indicates Invalid syntax: ") Ω". When I input Z = (1 + 2i) Ω10, the result is Z = (1 + 2i) Ω·10 = 10 Ω only. However, when I input (1 + 2i) Ω10 which I don't assign to any variables, the output window indicates (1 + 2i) Ω·10 = (10 + 20i) Ω as correct result. Is my inputting method wrong? How to fix it?

Proektsoftbg commented 9 months ago

Hi! Thank you for your feedback.

The correct way is to write it as Z=(1+2i)*Ω. But I do not know why the imaginary part disappears when assigning to a variable. Probably it is a bug. Without assigning it works correctly and assigning without units, too. I will check this out and fix it.

ThomsonTanminxin commented 9 months ago

Thank you. This is a very useful software.

Proektsoftbg commented 9 months ago

Hi! I found it! :)

Before assigning to a variable, units have to be "normalized". This is because units are internally decomposed to the basic physical dimensions and after calculations, they carry some residual scaling factors. Normalization is required for substituting correctly the variables in the next equations. However, a small bug has squeezed there. Terminated!

You can download the updated version from the following link: https://github.com/Proektsoftbg/Calcpad/releases/tag/v6.1.4

Thank you for reporting that. Before anything else, it is most important for a calculation software is to provide correct results.

ThomsonTanminxin commented 9 months ago

Now the result is correct. Thank you.

Proektsoftbg commented 9 months ago

Great! Thank you too. Then, I will close this issue as completed.