Answer the question
In order to leave comments, you need to log in
How to correctly calculate the value of a complex expression in C++?
Let there be a complex expression:
d3 = (k1*k2*exp(-a*k1*1.0i)*exp(a*k2*1.0i)*4.0i)/(k1*k2*2.0i...
+ k1^2*1.0i + k2^2*1.0i - k1^2*exp(a*k2*2.0i)*1.0i - ...
k2^2*exp(a*k2*2.0i)*1.0i + k1*k2*exp(a*k2*2.0i)*2.0i);
Answer the question
In order to leave comments, you need to log in
look in this direction https://ru.wikipedia.org/wiki/Complex.h
Complex.h is the header file of the standard library of the C programming language, which declares functions for complex arithmetic. These functions use the built-in complex type that was introduced in the C99 standard. Functions in the header file complex.h are presented for three types - double, float and long double (values are presented in radians): for calculating trigonometric values of sine, cosine, tangent and cotangent for complex numbers, logarithm and exponent, root.
I haven't programmed in C++ for 18 years, so don't judge strictly :)))
ready-made code in the sandbox
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question