This version of code is with long double (sizeof(long double)=12Bytes
= 96 bits) to increase precision.
In the original version there is only complex.
Could you advice me how to solve this problem ?
TIA
Did you mean to calculate
b4 = b2 - b3;
???
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
I think you cannot - the reason is that the "well known mathematical
rules" actually don't work that way, when we're dealing with functions of
complex variable. Look:
octave:14> log(exp(i*pi))
ans = 0.00000 + 3.14159i
octave:15> log(exp(i*pi*2))
ans = 0.0000e+00 - 2.4492e-16i
octave:16> log(exp(i*pi*3))
ans = 0.00000 + 3.14159i
The problem is that eg. the function Imag(log(exp(x*i))) = arccos(cos(i))
simply isn't identity (and cannot be).
Regards
Jiri Palecek
Sorry for the delay, but what do you suggest to solve this problem?
I also implemented an overloading of the function pow with same
result....
> On 25 Set, 16:24, Ji�� Pale�ek <jpale...@web.de> wrote:
>> I think you cannot - the reason is that the "well known mathematical ďż˝
>> rules" actually don't work that way, when we're dealing with functions
>> of ďż˝
>> complex variable. Look:
>>
>> octave:14> log(exp(i*pi))
>> ans = �0.00000 + 3.14159i
>> octave:15> log(exp(i*pi*2))
>> ans = 0.0000e+00 - 2.4492e-16i
>> octave:16> log(exp(i*pi*3))
>> ans = �0.00000 + 3.14159i
>>
>> The problem is that eg. the function Imag(log(exp(x*i))) =
>> arccos(cos(i)) ďż˝
... note: this only holds in the first two quadrants, but the argument
stay intact
>> simply isn't identity (and cannot be).
>
> Sorry for the delay, but what do you suggest to solve this problem?
> I also implemented an overloading of the function pow with same
> result....
I'm afraid this "problem" cannot be solved in general, and certainly not
by implementing some function in C++. You must specify what exactly you
want to do with your complex numbers, so we can find a workaround -
otherwise, you have to deal with the fact that (a^b)^c==a^(b*c) only works
for natural powers (+negative) when dealing with complex numbers.
Regards
Jiri Palecek