Hello,

I have used taylor polynomials to approximate floating-point values before. I am wondering whether there is a way to still apply them to functions with complex arguments, and if there is a way what its constraints would be. For example, to calculate the sine of a floating-point number to a specific precision I keep adding terms until the error value is less than the precision. However, I noticed (by testing it with the taylor expansion of ln(x) ) that this gives the wrong value when I use complex numbers (with the standard operators appropriately defined). For example:

``````ln(0.5)~=-(0.5+(0.5^2)/2+(0.5^3)/3)     --- gives -0.66, real is -0.69                Close enough
ln(0.5i)~=-(0.5i+(0.5i^2)/2+(0.5i^3)/3) --- gives -0.25+0.33i, real is -0.69+1.57i    WHAAT?!
``````

How can I approximate imaginary functions to within an error range? Basically I need a method such that if I give you any given function's definition, a complex number, and a rational number (floating-point value) you can give me the value of that given function, at that given complex number, accurate in both real and imaginary parts, to within +- the given rational number. Clearly standard taylor polynomials dont always work, so what does?

Did you try to use more terms?
My first guess is that the series of ln(0.5i) converges much slower than the series of ln(0.5).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.