hi.. this is part of an assignment.. but any help will be greatly appreciated

F(0) = 0
where F(z) is a linear polynomial of order n with complex coefficients

F(z) = A(n)Z^n + A(n-1)Z^n-1 + ... + A(1) Z + A(0) = 0

this hasent formatted very well.. it's A(subscript n-1) and then Z to the power n-1.

I need to solve the comlplex roots Z(1),Z(2),Z(3)...Z(n)

i have already written a complex solver for simple functions eg x^2 = cos(x)-tan(x) and x^x. and i have written a complex quadratic solver. but i am unsure how to implement this function.
i know that when n=2 my quadratic solver should be able to solve the two remaining roots.
does anyone have any advice?

I, personally, don't know...
...but I did find this.

I, personally, don't know...
...but I did find this.

i had found that myself before.. but alas it is of no help to me. my newtons solver works pertectly and i use analytical differentiation... but i cant see how i can transform the series into a form that i can use

Newton's Method works exactly the same for an equation with complex coefficients as it does for an equation with only real coefficients. The only difference is the extra bit of algebra involved for manipulating complex numbers.

For example, dividing real numbers is as simple as doing a/b.

However, dividing complex numbers involves a little more:

z1 = x + iy
z2 = u + iv

z1/z2 = (x + iy)/(u + iv)

= {(x + iy)/(u + iv)}*{(u - iv)/(u - iv)}

= {(x + iy)*(u - iv)}/{u^2 + v^2)}

It is a bit more hassle, but doable.

One suggestion I can make:
the starting point of the algorithm MUST BE OFF THE REAL AXIS. If you start the algorithm with an initial guess for the zero of the equation as a real-only number, Newton's Method will never leave the real axis. If the root is complex, it will never be found. So always ensure that your initial guess for a root is complex.

Newton's Method works exactly the same for an equation with complex coefficients as it does for an equation with only real coefficients. The only difference is the extra bit of algebra involved for manipulating complex numbers.

For example, dividing real numbers is as simple as doing a/b.

However, dividing complex numbers involves a little more:

z1 = x + iy
z2 = u + iv

z1/z2 = (x + iy)/(u + iv)

= {(x + iy)/(u + iv)}*{(u - iv)/(u - iv)}

= {(x + iy)*(u - iv)}/{u^2 + v^2)}

It is a bit more hassle, but doable.

One suggestion I can make:
the starting point of the algorithm MUST BE OFF THE REAL AXIS. If you start the algorithm with an initial guess for the zero of the equation as a real-only number, Newton's Method will never leave the real axis. If the root is complex, it will never be found. So always ensure that your initial guess for a root is complex.

this is the gerenal terms of my basic complex newton. the complex division and addtion are simple... i am still doing maths. but the complex library has all this taken care of anyway. this example solves x^x = c where c is enterd from the keyboard. it works fine, xnew has an inital starting value of (2,0). its the function f (that is f(x)) that is more difficult. so far im just summating the series and (trying to) store the coefficients in a septerate array so they can be passed into my complex quadratic solver. (thats for when n=2, i.e ax^2 + bx + c ) where a,b,c are complex<double>

complex<double> newton(complex<double> xnew,complex<double> c)
{

int s=0;
double err=1.0;

   while(err > ERROR) 
	{	

	
		err=abs(f(xnew,c)/f1(xnew,c)); //err=abs(err);		
												
		xnew = xnew-f(xnew,c)/f1(xnew,c);
	
	 s++;
	}
   cout <<"iterations: " <<s<<endl;
	return(xnew);
	
}
complex<double> f(complex<double> x, complex<double> c)
{
  return x*log(x)-log(c);/// example enter c = 27 return x= 3
  // when this becomes 0 interceptin x axis = value xnew
}

complex<double> f1(complex<double> x,complex<double> c)
{

return	(f(x+0.05,c)- f(x-0.05,c))/0.1;

}
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.